#!/bin/sh # # jobscript-watcher This shell script takes care of starting and stopping # the jobscript-watcher daemon used to send PBS job script # submissions to a database for support and analysis # purposes. # # chkconfig: 345 99 99 # description: PBS manages batch jobs for the system. export PBS_INSTALL=/opt/torque/default export PBS_HOME=/var/spool/torque LOCKFILE=/var/lock/subsys/jobscript-watcher PIDFILE=/var/run/jobscript-watcher.pid args="-p $PIDFILE" export PATH="${PBS_INSTALL}/sbin:${PBS_INSTALL}/bin:/usr/local/sbin:${PATH}" # See how we were called. case "$1" in start) # Start daemons. echo -n "Starting jobscript-watcher: " jobscript-watcher $args RETVAL=$? [ "$RETVAL" = 0 ] && touch $LOCKFILE echo ;; stop) # Stop daemons. echo -n "Shutting down jobscript-watcher: " killall jobscript-watcher RETVAL=$? [ "$RETVAL" = 0 ] && rm -f $LOCKFILE \ && rm -f $PIDFILE echo ;; restart) $0 stop $0 start ;; *) echo "Usage: jobscript-watcher {start|stop|restart}" exit 1 esac exit 0