#!/bin/bash # # Linux system service run script (init file) for Synchronet # # This file normally goes in your /etc/init.d directory # # $Id: sbbs,v 1.3 2005/02/23 06:40:36 rswindell Exp $ # Replace the path in the following line with path to your sbbs directory SBBSDIR=/sbbs export SBBSCTRL=$SBBSDIR/ctrl ##################################### # RedHat Linux "chkconfig" info block # # chkconfig: 2345 89 11 # description: Synchronet BBS Software # # processname: sbbs # pidfile: /var/run/sbbs.pid ##################################### ##################################### # SUSE Linux "insserv" info block # (not currently used or tested) # ### BEGIN INIT INFO # Provides: sbbs # Required-Start: $network $syslog # Required-Stop: # Default-Start: 2 3 5 # Default-Stop: 0 1 6 # Description: Synchronet BBS Software ### END INIT INFO ##################################### # RedHat/SysVinit commands start_daemon="daemon" daemon_status="status" rc_status="save_status" rc_exit="exit" # load the function library (to define the daemon and killproc functions) if [ -f /etc/init.d/functions ] ; then # RedHat . /etc/init.d/functions elif [ -f /etc/rc.d/init.d/functions ] ; then # RedHat . /etc/rc.d/init.d/functions elif [ -f /etc/rc.status ] ; then # SUSE/LSB rc commands . /etc/rc.status # Reset status of this service rc_reset # Convert init commands to SUSE (rc.status) syntax start_daemon="startproc" daemon_status="checkproc" rc_status="rc_status -v" rc_exit="rc_exit" else echo $"Unsupported init type" exit 1 fi retval=0 prog="sbbs" proc="$SBBSDIR/exec/$prog" pidfile="/var/run/sbbs.pid" lockfile="/var/lock/subsys/sbbs" save_status() { retval=$? } start() { echo -n $"Starting $prog: " shift export SHELL=/bin/sh $start_daemon $proc -d $@ # Remember status and be verbose $rc_status echo [ $retval = 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $proc # Remember status and be verbose $rc_status echo [ $retval = 0 ] && rm -f $lockfile $pidfile return $retval } reload(){ echo -n $"Reloading $prog: " killproc $proc -HUP # Remember status and be verbose $rc_status echo return $retval } case "$1" in start) start $@ ;; stop) stop ;; status) $daemon_status $proc $rc_status ;; restart) stop start $@ ;; condrestart) if [ -f $pidfile ] ; then stop start $@ fi ;; reload) reload ;; *) echo $"Bad argument: '$1'" echo $"Usage: $0 {start|stop|restart|condrestart|status|reload}" retval=1 esac $rc_exit $retval