#!/bin/sh # vim:ft=sh # # skeleton example file to build /etc/init.d/ scripts. # This file should be used to construct scripts for /etc/init.d. # # Written by Miquel van Smoorenburg . # Modified for Debian GNU/Linux # by Ian Murdock . # Modified for the nbd-server package # by Wouter Verhelst # # Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl # ### BEGIN INIT INFO # Provides: nbd-server # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: $network # Should-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Network Block Device server ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON="/bin/nbd-server" NAME="nbd-server" DESC="Network Block Device server" NAME=nbd-server PIDFILE=/var/run/$NAME.pid # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present # and status_of_proc is working. . /lib/lsb/init-functions test -x $DAEMON || exit 0 # # Function that sends a SIGHUP to the daemon/service # do_reload() { # # If the daemon can reload its configuration without # restarting (for example, when it is sent a SIGHUP), # then implement that here. # start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME return 0 } case "$1" in start) start-stop-daemon --start --quiet --exec /bin/nbd-server --oknodo --pidfile $PIDFILE echo " $NAME." ;; stop) echo -n "Stopping $DESC:" start-stop-daemon --stop --quiet --exec /bin/nbd-server --oknodo --pidfile $PIDFILE --retry 1 echo " $NAME." ;; restart|force-reload) echo "Restarting the $DESC is pretty harsh on clients still using it." echo -n "waiting 5 seconds..." sleep 5 echo "You have been warned!" echo -n "Restarting $DESC: " $0 stop sleep 10 $0 start ;; reload) log_daemon_msg "Reloading $DESC" "$NAME" do_reload log_end_msg $? ;; *) N=/etc/init.d/$NAME # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0