1 | #!/bin/tcsh |
---|
2 | # |
---|
3 | # description: check that epics2rrd (EPICS->RRD update) script is running |
---|
4 | # |
---|
5 | # processname: checkup-epics2rrd |
---|
6 | |
---|
7 | ########### SVN repository information ################### |
---|
8 | # $Date: 2010-08-26 21:07:09 +0000 (Thu, 26 Aug 2010) $ |
---|
9 | # $Author: jemian $ |
---|
10 | # $Revision: 208 $ |
---|
11 | # $HeadURL$ |
---|
12 | # $Id: checkup-epics2rrd.csh 208 2010-08-26 21:07:09Z jemian $ |
---|
13 | ########### SVN repository information ################### |
---|
14 | |
---|
15 | setenv RRD_LOGS_BASE_DIR /home/joule/WEB33/www/rrd |
---|
16 | setenv SCRIPT ${RRD_LOGS_BASE_DIR}/epics2rrd.csh |
---|
17 | setenv LOGFILE ${RRD_LOGS_BASE_DIR}/epics2rrd.log |
---|
18 | setenv PIDFILE ${RRD_LOGS_BASE_DIR}/epics2rrd.pid |
---|
19 | |
---|
20 | #echo "#====================" >>& ${LOGFILE} |
---|
21 | #echo "#`date`" >>& ${LOGFILE} |
---|
22 | set pid = `/bin/cat ${PIDFILE}` |
---|
23 | #set test = `/bin/ps -p ${pid} --no-header -o pid` |
---|
24 | set test = `/bin/ps -p ${pid} -o pid | sed 's+PID++'` |
---|
25 | |
---|
26 | ##/bin/echo "`env`" >>& ${LOGFILE} |
---|
27 | #/bin/echo "pid = <$pid>" >>& ${LOGFILE} |
---|
28 | #/bin/echo "test = <$test>" >>& ${LOGFILE} |
---|
29 | |
---|
30 | if (${pid} != ${test}) then |
---|
31 | echo "#====================" >>& ${LOGFILE} |
---|
32 | echo "# `/bin/date` could not identify running process ${pid}, restarting" >>& ${LOGFILE} |
---|
33 | #echo `${SCRIPT} stop` >& /dev/null |
---|
34 | #echo `${SCRIPT} start` >& /dev/null |
---|
35 | |
---|
36 | echo `${SCRIPT} stop` >>& ${LOGFILE} |
---|
37 | echo `${SCRIPT} start` >>& ${LOGFILE} |
---|
38 | #else |
---|
39 | # echo "${pid} and ${test} must be equal" >>& ${LOGFILE} |
---|
40 | endif |
---|
41 | |
---|
42 | #echo "end of checkup script" >>& ${LOGFILE} |
---|
43 | # log EPICS PVs into RRD for WWW browsing of logs |
---|
44 | # * * * * * /home/joule/WEB33/www/rrd/htmlCreate.py >& /home/joule/WEB33/www/rrd/htmlCreate.log |
---|
45 | # 1,6,11,16,21,26,31,36,41,46,51,56 * * * * /home/joule/WEB33/www/rrd/checkup-epics2rrd.csh 2>&1 /dev/null |
---|