28 lines
388 B
Bash
Executable file
28 lines
388 B
Bash
Executable file
#!/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"
|