#! /bin/sh # $local_fs all local file systems are mounted # (most services should need this!) # $remote_fs all remote file systems are mounted # (note that /usr may be remote, so # many services should Require this!) # $syslog system logging facility up # $network low level networking (eth card, ...) # $named hostname resolution available # $netdaemons all network daemons are running # Check for missing binaries (stale symlinks should not happen) PROFTPD_BIN=/usr/local/sbin/proftpd test -x $PROFTPD_BIN || exit 5 # Check for existence of needed config file and read it PROFTPD_CONFIG=/usr/local/etc/proftpd.conf test -r $PROFTPD_CONFIG || exit 6 # . $PROFTPD_CONFIG . /etc/rc.status # Reset status of this service rc_reset case "$1" in start) echo -n "Starting ProFTPD " ## Start daemon with startproc(8). If this fails ## the return value is set appropriately by startproc. startproc $PROFTPD_BIN # Remember status and be verbose rc_status -v ;; stop) echo -n "Shutting down ProFTPD " ## Stop daemon with killproc(8) and if this fails ## killproc sets the return value according to LSB. killproc -TERM $PROFTPD_BIN # Remember status and be verbose rc_status -v ;; try-restart) ## Do a restart only if the service was active before. ## Note: try-restart is not (yet) part of LSB (as of 1.2) $0 status >/dev/null && $0 restart # Remember status and be quiet rc_status ;; restart) ## Stop the service and regardless of whether it was ## running or not, start it again. $0 stop $0 start # Remember status and be quiet rc_status ;; force-reload) ## Signal the daemon to reload its config. Most daemons ## do this on signal 1 (SIGHUP). ## If it does not support it, restart. echo -n "Reload service ProFTPD " ## if it supports it: killproc -HUP $PROFTPD_BIN #touch /var/run/FOO.pid rc_status -v ## Otherwise: #$0 stop && $0 start #rc_status ;; reload) ## Like force-reload, but if daemon does not support ## signaling, do nothing (!) # If it supports signaling: echo -n "Reload service PROFTPD " killproc -HUP $PROFTPD_BIN #touch /var/run/FOO.pid rc_status -v ## Otherwise if it does not support reload: #rc_failed 3 #rc_status -v ;; status) echo -n "Checking for service ProFTPD " ## Check status with checkproc(8), if process is running ## checkproc will return with exit status 0. checkproc $PROFTPD_BIN # NOTE: rc_status knows that we called this init script with # "status" option and adapts its messages accordingly. rc_status -v ;; probe) ## Optional: Probe for the necessity of a reload, print out the ## argument to this init script which is required for a reload. ## Note: probe is not (yet) part of LSB (as of 1.2) # test /etc/FOO/FOO.conf -nt /var/run/FOO.pid && echo reload ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" exit 1 ;; esac rc_exit