#!/bin/bash # # Init file for DIM archiving daemon # # chkconfig: - 66 34 #description: DIM archiving daemon # #processname: dimarchd #config: /etc/trd/dimarch.conf #source function library . /etc/rc.d/init.d/functions #for my working dir #prog : body # progname="dimarchd" prog=/usr/sbin/dimarchd lockfile=/var/lock/subsys/dimarchd #[ -f $conffile ] || exit $? RETVAL=0 start() { echo -n $"Starting $progname: " $prog && success || failure RETVAL=$? [ "$RETVAL" = 0 ] && touch "$lockfile" echo return $RETVAL } stop() { echo -n $"Stopping $progname: " if [ -n "`pidofproc $prog`" ]; then killproc $prog RETVAL=$? else failure $"Stopping $prog" fi [ $RETVAL -eq 0 ] && rm -f "$lockfile" echo return $RETVAL } #See how we were called. case "$1" in start) start ;; stop) stop ;; status) status $prog ;; restart) stop start ;; condrestart) if [ -f "$lockfile" ]; then stop start fi ;; *) echo $"Usage: $prog {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL