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]

Getting Started with Golang

Go Applications A Go app can vary from 3 to millions of lines of code. They should also be written with one or multiple files with the extension .go You can use any text editor to write a Go program like nano, but our favorite and most supported is Visual Studio Code. Setting up a Go Environment For all of our tutorials we will be using VSCode to help us ease into the language. [Read More]