#! /bin/sh # Copyright (c) 2001 Torsten Mohr # # Author: Torsten Mohr # # /etc/init.d/cfsd # # and symbolic its link # # /usr/sbin/cfsd # ### BEGIN INIT INFO # Provides: cfsd # Required-Start: network rpc # Required-Stop: network # Default-Start: 2 3 5 # Default-Stop: 2 3 5 # Description: cryptograpic file system daemon ### END INIT INFO . /etc/rc.status . /etc/rc.config # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} # Force execution if not called by a runlevel directory. test $link = $base && START_CFSD=yes test "$START_CFSD" = yes || exit 0 # Shell functions sourced from /etc/rc.status: # rc_check check and set local and overall rc status # rc_status check and set local and overall rc status # rc_status -v ditto but be verbose in local rc status # rc_status -v -r ditto and clear the local rc status # rc_failed set local and overall rc status to failed # rc_reset clear local rc status (overall remains) # rc_exit exit appropriate to overall rc status # First reset status of this service rc_reset case "$1" in start) echo -n "Starting cfsd..." ## Start daemon with startproc(8). If this fails ## the echo return value is set appropriate. startproc /usr/sbin/cfsd && \ sleep 3 && \ /bin/mount -o port=3049,intr,rsize=2048,wsize=2048 \ localhost:/.cfsfs /crypt # Remember status and be verbose rc_status -v ;; stop) echo -n "Shutting down cfsd..." ## Stop daemon with killproc(8) and if this fails ## set echo the echo return value. killproc -TERM /usr/sbin/cfsd # Remember status and be verbose rc_status -v ;; restart) ## If first returns OK call the second, if first or ## second command fails, set echo return value. $0 stop && $0 start # Remember status and be quiet rc_status ;; reload) ## Exclusive possibility: Some services must be stopped ## and started to force a new load of the configuration. $0 stop && $0 start # Remember status and be verbose rc_status -v ;; status) echo -n "Checking for cfsd: " ## Check status with checkproc(8), if process is running ## checkproc will return with exit status 0. checkproc /usr/sbin/cfsd && echo OK || echo No process ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 1 ;; esac rc_exit