Skip to content

Instantly share code, notes, and snippets.

@provegard
Last active June 17, 2018 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save provegard/cdc2579a79d5afdbbe6fce9f7b1e6359 to your computer and use it in GitHub Desktop.
Save provegard/cdc2579a79d5afdbbe6fce9f7b1e6359 to your computer and use it in GitHub Desktop.
Script for sending sms on server start
#!/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