Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@jaanauati jaanauati commented Oct 28, 2016

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