Rev 1044 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/usr/bin/env bash#set -xBLATUSR=releasemBLATBIN=/home/${BLATUSR}/blatPID="${BLATBIN}/run/blat.pid"ARG=$1cd "$BLATBIN"start () {echo Starting blat daemon now...su - ${BLATUSR} -c "perl $BLATBIN/blat.pl -pid=$PID 2>/tmp/blat.log 1>&2"}stop () {if [ -f $PID ]; thenecho Stopping daemon now...kill $(cat $PID);elseecho "No pidfile found (not running?)"fi}logrotate () {echo Triggering a logrotatekill -HUP $(cat $PID)}## Setup init levels# Linux and Solaris are different#setup() {if [ ! -f /etc/init.d/blatdaemon ] ; thenecho "Error: /etc/init.d/blatdaemon does not exist"exit 1fimtype=`uname`case "$mtype" inLinux)for ii in 2 3 4 5; dofile=/etc/rc.d/rc$ii.d/S80blatdaemon[ -f $file ] || ln -s /etc/init.d/blatdaemon $filedonefor ii in 0 1 6 ; dofile=/etc/rc.d/rc$ii.d/K30blatdaemon[ -f $file ] || ln -s /etc/init.d/blatdaemon $filedone;;SunOS)for ii in 2 3; dofile=/etc/rc$ii.d/S80blatdaemon[ -f $file ] || ln -s /etc/init.d/blatdaemon $filedonefor ii in 0 1 S ; dofile=/etc/rc$ii.d/K30blatdaemon[ -f $file ] || ln -s /etc/init.d/blatdaemon $filedone;;*)echo "$0 setup - Unknown machine type: $mtype"exit 1;;esac}case $ARG instart)start;;stop)stop;;restart)stopstart;;logrotate)logrotate;;setup)setup;;*)echo "Usage: $0 <start|stop|restart|logrotate|setup>"exit 1;;esac