Skip to content

Instantly share code, notes, and snippets.

@provegard
Last active Jun 17, 2018
Embed
What would you like to do?
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