10 [ "$forcedelay" -ge 1 ] && {
13 echo b > /proc/sysrq-trigger # Will immediately reboot the system without syncing or unmounting your disks.
18 local period="$1"; local forcedelay="$2"
20 sleep "$period" && shutdown_now "$forcedelay"
24 local period="$1"; local forcedelay="$2"; local pinghosts="$3"; local pingperiod="$4"
26 time_now="$(cat /proc/uptime)"
27 time_now="${time_now%%.*}"
34 time_now="$(cat /proc/uptime)"
35 time_now="${time_now%%.*}"
37 for host in "$pinghosts"
39 if ping -c 1 "$host" &> /dev/null
43 time_diff="$((time_now-time_last))"
44 logger -p daemon.info -t "watchcat[$$]" "no internet connectivity for $time_diff seconds. Reseting when reaching $period"
48 time_diff="$((time_now-time_last))"
49 [ "$time_diff" -ge "$period" ] && shutdown_now "$forcedelay"
54 if [ "$mode" = "allways" ]
56 watchcat_allways "$2" "$3"
58 watchcat_ping "$2" "$3" "$4" "$5"