Last active
June 17, 2018 09:18
-
-
Save provegard/cdc2579a79d5afdbbe6fce9f7b1e6359 to your computer and use it in GitHub Desktop.
Script for sending sms on server start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
msg="$SERVER has started." | |
shutdown_dt=$(last -x --time-format iso |grep shutdown | head -n 1 | awk '{print $7}') | |
if [ -n "$shutdown_dt" ]; then | |
msg="$msg Shutdown at $shutdown_dt" | |
fi | |
echo $msg | /usr/local/bin/send-sms.sh $PHONE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment