Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-20 07:59:01

0001 #!/bin/sh
0002 #
0003 # chkconfig: - 85 15
0004 #
0005 # description: Panda Harvester
0006 # processname: python
0007 # config: ${VIRTUAL_ENV}/etc/sysconfig/panda_harvester
0008 # pidfile: $VIRTUAL_ENV}/var/log/panda/panda_harvester.pid
0009 
0010 # When multiple arguments are given, only the error from the _last_
0011 # one is reported.
0012 #
0013 ARGV="$@"
0014 #
0015 # |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
0016 # --------------------                              --------------------
0017 #
0018 # setup python and virtual env
0019 # load module python
0020 VIRTUAL_ENV=/FIXME
0021 . ${VIRTUAL_ENV}/bin/activate
0022 
0023 # Source harvester env variables
0024 if [ -r ${VIRTUAL_ENV}/etc/sysconfig/panda_harvester ]; then
0025    . ${VIRTUAL_ENV}/etc/sysconfig/panda_harvester
0026 fi
0027 
0028 # the path to application
0029 PROGNAME='python -u '${SITE_PACKAGES_PATH}'/pandaharvester/harvesterbody/master.py'
0030 # --foreground is required to run under supervisord
0031 # PROGNAME='python -u '${SITE_PACKAGES_PATH}'/pandaharvester/harvesterbody/master.py --foreground'
0032 
0033 # pid and lock files
0034 PIDFILE=${VIRTUAL_ENV}/var/log/panda/panda_harvester.pid
0035 
0036 # log files
0037 HSTDOUT=${VIRTUAL_ENV}/var/log/panda/panda_harvester_stdout.log
0038 HSTDERR=${VIRTUAL_ENV}/var/log/panda/panda_harvester_stderr.log
0039 
0040 ERROR=0
0041 if [ "x$ARGV" = "x" ] ; then 
0042     ARGV="-h"
0043 fi
0044 
0045 
0046 case $ARGV in
0047 start)
0048     if [ -f $PIDFILE ]; then
0049         echo ERROR: Harvester is already running with pidfile:$PIDFILE
0050     else
0051         echo start Harvester
0052         for itry in `seq 1 1`
0053         do
0054             echo trying $itry
0055             $PROGNAME --pid $PIDFILE >> $HSTDOUT 2>> $HSTDERR
0056             sleep 5
0057             ps -p `cat $PIDFILE` > /dev/null
0058             ERROR=$?
0059             echo $ERROR
0060             if [ $ERROR = 0 ]; then
0061                 echo succeeded
0062                 break
0063             else
0064                 echo failed
0065                 rm -f $PIDFILE
0066             fi
0067         done
0068     fi
0069     ;;
0070 stop)
0071     echo stop Harvester
0072     kill -USR2 `cat $PIDFILE`
0073     ERROR=$?
0074     rm -f $PIDFILE
0075     echo $ERROR
0076     ;;
0077 *)
0078     echo ERROR: unknown command $ARGV 
0079     ERROR=1
0080 esac
0081 
0082 exit $ERROR
0083