1
0
Fork 0

powercuts and reboots

This commit is contained in:
Maurice Debray 2026-01-24 13:12:16 +01:00
parent 9271aeb39a
commit 0351216f34
2 changed files with 52 additions and 0 deletions

24
powercut.sh Executable file
View file

@ -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"

28
reboot.sh Executable file
View file

@ -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"