Advertisement
DD3AH

check for scheduled reboot

Jul 7th, 2021 (edited)
1,304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ## CheckScheduledReboot
  4. # (C)2021 nobs@nobswolf.info
  5. #
  6. # Checks whether a shutdown is scheduled on a systemd-system
  7. # and gives some information about it.
  8.  
  9. if [ -e /var/run/systemd/shutdown/scheduled ]
  10. then
  11.         (
  12.         while read -r x
  13.         do
  14.                 declare -- "${x}"  
  15.         done
  16.  
  17.         echo -n "$MODE at "
  18.         date -d "@${USEC::-6}"
  19.         echo If unwanted, cancel with:
  20.         echo shutdown -c
  21.         ) < /var/run/systemd/shutdown/scheduled
  22. else
  23.         echo none
  24. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement