1 # Typical Debian initscript, but as a library rather than copy-paste.
5 # DESC="Textual description"
6 # SCRIPTNAME=/etc/init.d/$NAME # default if omitted
7 # . /lib/init/std-init.sh
10 # do_reload() { ... } # optional
14 . /lib/lsb/init-functions
16 [ -r /etc/default/"$NAME" ] && . /etc/default/"$NAME"
18 SCRIPTNAME="${SCRIPTNAME:-/etc/init.d/$NAME}"
22 type do_reload >/dev/null 2>/dev/null
28 echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
30 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
42 if have_reload; then cmd=reload; else usage_exit; fi ;;
44 if have_reload; then cmd=reload; else cmd=restart; fi ;;
51 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
54 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
55 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
59 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
62 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
63 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
67 log_daemon_msg "Reloading $DESC" "$NAME"
72 log_daemon_msg "Restarting $DESC" "$NAME"
79 1) log_end_msg 1 ;; # Old process is still running
80 *) log_end_msg 1 ;; # Failed to start