configurations/testbed/scripts/schedule-poweroff.sh

14 lines
280 B
Bash
Raw Normal View History

2023-04-28 13:32:33 +08:00
#!/bin/bash
set -ex
2023-04-28 15:11:16 +08:00
SKIP_FILE=/tmp/skip-poweroff
2023-04-28 13:32:33 +08:00
/bin/date
2023-04-28 15:11:16 +08:00
if [[ -f "$SKIP_FILE" ]]; then
echo "poweroff skipped for this time."
rm -rf "$SKIP_FILE"
else
/sbin/shutdown -h 60
wall "The system shutdown is scheduled in 1 hour. Use 'shutdown -c' to cancel."
fi
echo