Skip to content

Instantly share code, notes, and snippets.

@sistematico
Last active October 7, 2015 16:48
Show Gist options
  • Save sistematico/3196309 to your computer and use it in GitHub Desktop.
Save sistematico/3196309 to your computer and use it in GitHub Desktop.
Online.sh
#!/bin/sh
TITLE=${HOST}
MSG="Machine $HOST is online!"
NOTIFY="/usr/bin/mate-notify-send"
USER="lucas"
HOST="192.168.0.3"
TIME=10
URG="critical"
ping -q -n -c 1 $HOST > /dev/null
if [ $? = 0 ]; then
TIME2=`echo "$TIME * 1000" | bc`
ssh ${USER}@${HOST} "DISPLAY=:0 $NOTIFY -t ${TIME2} -u $URG $TITLE $MSG"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment