daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Mar 21st, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # Precondition: `export PROMPT_COMMAND="history -a"` in .bashrc for ubuntu user
  4.  
  5. set -eux
  6.  
  7. COMMAND_TIME=$(date -Is -r /home/ubuntu/.bash_history)
  8. NOW=$(date -Is)
  9.  
  10. if [[ $(date -d "$NOW" +%s) -lt $(date -d "$COMMAND_TIME +60 minutes" +%s) ]]; then
  11.   echo "Less then 60 minutes after .bash_history. Keep power-on."
  12.   exit 0
  13. fi
  14.  
  15. echo "60+ min after .bash_history. Shutdown after 10 seconds!"
  16. sleep 10
  17. echo "Shutdown NOW!"
  18. shutdown -h now
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top