[Proxmox Timed Shutdown]

- Backup query has been moved after sleep function to prevent bogus results.
This commit is contained in:
2022-06-29 22:57:28 +01:00
parent 9a521cd1aa
commit 2029eb40bc
+5 -10
View File
@@ -1,17 +1,12 @@
#!/bin/bash
QUERY_BACKUP_TASK=$( ps -ef | grep vzdump | wc -l)
if ! [ -z $C_SHUTDOWN ]; then
if [ $C_SHUTDOWN -eq "1" ]; then
echo "Shutdown has been cancelled due to ENV"
exit 1
fi
fi
echo "Waiting 1hr to allow user to cancel shutdown"
sleep 1h
if [ $QUERY_BACKUP_TASK -eq 1 ]; then
if [ `ps -ef | grep vzdump | wc -l` -eq 1 ]; then
echo "Triggering scheduled post-backup shutdown"
/usr/sbin/shutdown -h now
/usr/sbin/shutdown -h now
else
echo "Automatic shutdown not triggered due to concurrent backup task"
exit 2
exit 2
fi