Skip to content

Instantly share code, notes, and snippets.

@asabaylus
Last active October 28, 2016 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save asabaylus/0dfdf6d691437aa2115b00fda760a979 to your computer and use it in GitHub Desktop.
Save asabaylus/0dfdf6d691437aa2115b00fda760a979 to your computer and use it in GitHub Desktop.
vsync-monitor
#!/bin/bash
# print last timestampe from last two log files
# "2016-10-28T14:21:28.022-04:00"
# compare the date to now and return if > 5 min
# convert date to unix epoch
if [ $# = 1 ]; then
now=$(date +"%F %T");
if [[ $(date -d `cat $(ls -1tr /syslog/vsynch/app*.log*) | grep "pushing changes" | cut -c1-19 | tail -1` +%s ) > `date -d "$1 secs ago" +%s` ]];
then echo "$now: VSYNC UP" >> /syslog/vsynch/vsync-monitor.log;
else mail -s "vsync down!" asa@baylus.com,cprocunier@gmail.com,parmstrong@ifthen.com < /dev/null;
fi
fi
@jaanauati
Copy link

if [[ $(date -d `cat $(ls -1tr app*.log*) | grep "pushing changes" | cut -c1-19 | tail -1` +%s ) > `date -d "5 mins ago" +%s` ]] ; then echo 'we cool bro ' ; else echo 'must send alert' ; fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment