Skip to content

Instantly share code, notes, and snippets.

@biiont
Created February 25, 2016 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biiont/c16cdd5a9052b0977915 to your computer and use it in GitHub Desktop.
Save biiont/c16cdd5a9052b0977915 to your computer and use it in GitHub Desktop.
Continiosly reboot target system by ssh until ssh returns connection error then beep.
CNT=1; ERR=0; while test $ERR -eq 0; do printf "Attempt: %3d at %s\n" $CNT "$(date)"; ssh -o 'VisualHostKey=no' root@192.168.21.72 /sbin/reboot; ERR=$?; test $ERR -eq 0 && sleep $((2 * 60)); CNT=$CNT+1; done; test $ERR -ne 0 && printf "Failed with code %d at %s" $ERR "$(date)" && paplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment