#!/usr/bin/perl -w # Name: checkLDM.pl # Date: 10 May 2005 # Author: Christopher Juckins # Purpose: SSH's to www as ldm, checks for running LDM # processes, sends email to sys admins if the processes have exited. # # To restart ldm on www, use /root/bin/startLDM.bash or # just follow the following procedure: #/bin/su - ldm -c "/home/ldm/bin/ldmadmin delqueue" #/bin/su - ldm -c "/home/ldm/bin/ldmadmin mkqueue" #/bin/su - ldm -c "/home/ldm/bin/ldmadmin clean" #/bin/su - ldm -c "/home/ldm/bin/ldmadmin start" open (LOG, ">/tmp/checkLDM.log"); $SYSADMIN = "username\@domain"; unless ($output = `ps -ef | grep ldm | grep ldm.pq | grep -v grep`) { print LOG "LDM is not running!!\n"; print LOG "Will attempt to restart LDM server.\n\n"; `/root/bin/startLDM.bash >> /tmp/checkLDM.log`; print LOG "Attempted to restart LDM server with /root/bin/startLDM.bash.\n"; print LOG "Output of \`ps -ef | grep ldm | grep ldm.pq | grep -v grep\` follows:\n\n"; print LOG `ps -ef | grep ldm | grep ldm.pq | grep -v grep`; `/bin/mail -s "Check LDM Server on WWW" $SYSADMIN