diff --git a/powercut.sh b/powercut.sh new file mode 100755 index 0000000..3650a42 --- /dev/null +++ b/powercut.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +echo "sleeping for 80s, then ping until up" + +sleep 80 + +while true; +do + if ping -w 1 -c 1 192.168.42.6 > /dev/null; then + break + fi +done + +echo "collecting logs" + +dir="./logs/$(date +"%Y%m%d_%H%M%S")-powercut" + +mkdir -p "$dir" + +touch "$dir/powercut" + +cp ./powercut.sh "$dir" + +echo "finished" diff --git a/reboot.sh b/reboot.sh new file mode 100755 index 0000000..420c8f4 --- /dev/null +++ b/reboot.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +SSH_OPTS="-o StrictHostKeyChecking=no" + +ssh $SSH_OPTS root@192.168.42.6 "reboot" + +echo "sleeping for 80s, then ping until up" + +sleep 80 + +while true; +do + if ping -w 1 -c 1 192.168.42.6 > /dev/null; then + break + fi +done + +echo "collecting logs" + +dir="./logs/$(date +"%Y%m%d_%H%M%S")-reboot" + +mkdir -p "$dir" + +touch "$dir/reboot" + +cp ./reboot.sh "$dir" + +echo "finished"