From: Joe Z. <jz...@us...> - 2003-04-26 22:39:46
|
Update of /cvsroot/bobs/bobs/inc/templates In directory sc8-pr-cvs1:/tmp/cvs-serv7450/bobs/inc/templates Added Files: servercheck2.sh Log Message: Add server specific configuration checks to systemcheck.php. --- NEW FILE: servercheck2.sh --- #!/bin/bash # servercheck.sh - Template for system check output # This will be a generated script rtnval="none" # If this script hangs, it will kill itself in this number of seconds # Timer code taken from "Advanced Bash-Scripting Guide" by Mendel Cooper TIMELIMIT=10 KILLTIME=30 # In case signal 14 isn't enough TimerOn() { # Waits TIMELIMIT seconds, then sends sigalarm to script. sleep $TIMELIMIT && kill -s 14 $$ 2>/dev/null & # Waits KILLTIME seconds, then sends sigkill to script. sleep $KILLTIME && kill -SIGKILL $$ 2>/dev/null & } Int14Vector() { exit 14 } trap Int14Vector 14 # Timer interrupt (14) subverted for our purposes. TimerOn <!-- BEGIN DYNAMIC BLOCK: basictest --> rtnval="ICUUCME" <!-- END DYNAMIC BLOCK: basictest --> <!-- BEGIN DYNAMIC BLOCK: cmdwoutput --> cmdoutput=$({COMMAND} 2>&1) rtncod=$? rtnval=$(echo "$rtncod"; echo "$cmdoutput";) <!-- END DYNAMIC BLOCK: cmdwoutput --> <!-- BEGIN DYNAMIC BLOCK: writetest --> rtnval="none" TESTFILE={MOUNTDIR}/bobswritetest.out cmdoutput=$( { if [ -e $TESTFILE ]; then echo "file $TESTFILE already exists." exit 1; fi error=0 rtnval=0 echo "write file test" > $TESTFILE || error=1 cat $TESTFILE || error=1 rm -f $TESTFILE || error=1 if [ $error -eq 1 ]; then exit 1 fi } 2>&1 ) rtncod=$? rtnval=$(echo "$rtncod"; echo "$cmdoutput";) <!-- END DYNAMIC BLOCK: writetest --> echo "$rtnval" > {TEMPFILE} # Let the submitting process know my exit status exit 0 |