Skip to content

Instantly share code, notes, and snippets.

@entrity
Created April 30, 2014 14:25
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 entrity/c7e34ef78c9a5ee4837a to your computer and use it in GitHub Desktop.
Save entrity/c7e34ef78c9a5ee4837a to your computer and use it in GitHub Desktop.
Poll the Compulife server to check whether a new (data) update is available. Should be run daily as a cronjob. If a new update is available, emails notification to developers.
#!/bin/bash
LATEST_UPDATE=`curl http://www.compulife.com/US_update/UPDATE.DAT`
LATEST_UPDATE_FILE=$HOME/compulife-last-update.dat
echo Running compulife update test | wall
# Compose email
read -r -d '' BODY <<EOM
Compulife update available
$LATEST_UPDATE
1. Run N:\COMPLIFE\gowin.exe
i. Install monthly and mid-monthly updates
2. Run N:\COMPLIFE\_prep-Update.bat
i. (It copies files from Cannex to C:\COMPUPDATE\)
3. FTP files from C:\COMPUPDATE\ to /var/www/new-compulife/cgi-bin/COMPLIFE/
i. on the CLU server
ii. on the DR server
Done.
EOM
echo -e last update on record: $(cat $LATEST_UPDATE_FILE)\nlast update on check: $LATEST_UPDATE | wall
if [[ ! -e $LATEST_UPDATE_FILE || "$(cat $LATEST_UPDATE_FILE)" != "$LATEST_UPDATE" ]]; then
# Save latest update time
echo $LATEST_UPDATE > $LATEST_UPDATE_FILE
# Send email
echo -e "$BODY" | mail -s "Compulife update available" developers@pinneyinsurance.com -- -f root@qa
fi
echo Finished compulife update test | wall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment