Out of curiosity I want to test my ISP stability/uptime. Easiest way I think of is to run scheduler with ping 8.8.8.8 every few seconds, and report if there is output other than normal ping reply.
This is what I came up with:
Code: Select all
:local file
:local time
:local date
:set time [/system clock get time]
:set date [/system clock get date]
:local file ([:pick $date 7 11]."-".[:pick $date 0 3]."-".[:pick $date 4 6])
:if ([/ping 8.8.8.8 count=5] = 0) do={
:log error "Ping error"
/file print file="$file"
:delay 1s
/file set [find name~"$file"] contents=$time
}
FIle is created but every time when ping fails it overwrite file with fresh time.
I need it to work like >> output.txt in cmd so it will write new line at the end instead of overwriting whole file. Is that doable? I want to have separate txt file for every day.