Quick Monitor and Restart in Golang
Go Applications On my desktop I was running a processing script that would occasionally hang at high CPU, so I wrote a quick script to monitor it and restart it. You can see it below and change it as needed.
Run it like so after compiling to a binary
nohup ./restart & The code
package main import ( "fmt" "io/ioutil" "log" "os/exec" "runtime" "strconv" "strings" "time" ) func getCPUSample() (idle, total uint64) { contents, err := ioutil.
[Read More]