Connects to a TCP service and logs the result into file. Download
Example, run for 5 days and write to file every 5 minutes.
./demon-logger-osx -host 127.0.0.1 -flush 300 -age 5
Usage of ./demon-logger-osx:
-age int
How long the app runs in days. (default 2)
-flush int
Write to disk interval in seconds (default 300)
-host string
Host IP (default "127.0.0.1")
env GOOS=linux GOARCH=arm GOARM=7 go build -o "demon-logger-arm"
It can not be determined without a ping/keepalive if the network is still working. As solution use the keepalive package or SetReadDeadline. I am not sure if the keepalive package works perfectly, but it is good enough.
MIT