Example of a Notify script to let you know your study server is down

Attached is a notify.pl script that will notify you by email when the study server goes down.

#!/usr/bin/perl# Survox study server failure notify script# Set this up in a cron job to run every 5 or 10 minutes, e.g.:# # server failure notify# 05,15,25,35,45,55 * * * * /cfmc/bin/notify.pl## The idea is to run super and make sure the string# "Enter a SUPERVISOR command" comes up in the output.#   If it doesn't, then we are assuming that the server is down.# In this instance, email will be sent to those in the @alert list.# NOTE: It's recommended that you put in a pager email so you are notified # as soon as possible.#   At times, the super session will foul up so when super is run # the next time, the designated ldev for the super session will be# unavailable.  In this instance, the next available ldev will be# chosen and email will be sent to those in the @notify list# UNCOMMENT AND CHANGE THE FOLLOWING TO CONFORM TO YOUR SYSTEM# Study server has problem (NOTE: before the @ is necessary)# @alert = ("your_name@your_company.com","your_pager@your_company.com);  # Super has problem (LDEV changed) (NOTE: before the @ is necessary)# @notify =("your_name@your_company.com"); # Define all of your Survox environments here (NOTE:last / is necessary)# @locs=("/cfmc/rel7.6s/","/cfmc/test7.7/"); $mail = "/bin/mail";$TERM = $ENV{TERM} = "vt100";$temp = "n$$.spx";$initldev=801;chomp($machine = `hostname -s`);foreach $CFMC(@locs) {my($already) = "notify.already.$loc";$ENV{CFMC}=$CFMC;$CFMCCFG=$ENV{CFMCCFG}="${CFMC}ipcfiles/";$go="${CFMC}go";($LDEV,$SOCKET,$cfgout) = &chkldev($initldev);$ENV{LDEV} = $LDEV;$ENV{SOCKET} = $SOCKET;#  print "DEBUG:LDEV:$LDEV SOCKET:$SOCKETn";<STDIN>;if ($LDEV != $initldev) {open(ALR,">>$already"); print ALR "$LDEVn";close(ALR);chomp($count = `cat $already