#!/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"