#! /bin/sh ### BEGIN INIT INFO # Provides: ursaryd # Required-Start: $local_fs $remote_fs pulseaudio # Required-Stop: $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Ursary control panel daemon ### END INIT INFO # Authors: Martin Mares # Do NOT "set -e" # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin:/opt/sbin:/opt/bin DESC="Ursary control panel daemon" NAME=ursaryd DAEMON=/usr/local/sbin/ursaryd DAEMON_ARGS="" PIDFILE=/run/ursaryd.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions do_start() { ulimit -c unlimited ucw-daemon-control --start --pid-file $PIDFILE -- $DAEMON $DAEMON_ARGS } do_stop() { ucw-daemon-control --stop --pid-file $PIDFILE } do_reload() { ucw-daemon-control --reload --pid-file $PIDFILE } do_status() { ucw-daemon-control --check --pid-file $PIDFILE } case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" do_start case "$?" in 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 100) [ "$VERBOSE" != no ] && log_progress_msg "already running" && log_end_msg 0 ;; 103) [ "$VERBOSE" != no ] && log_progress_msg "found dead, restarting" && log_end_msg 0 ;; *) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; stop) [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" do_stop case "$?" in 0) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 100) [ "$VERBOSE" != no ] && log_progress_msg "already stopped" && log_end_msg 0 ;; 103) [ "$VERBOSE" != no ] && log_progress_msg "already dead" && log_end_msg 0 ;; *) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; reload|force-reload) log_daemon_msg "Reloading $DESC" "$NAME" do_reload case "$?" in 0) log_end_msg 0 ;; 101|103) log_progress_msg "is not running" && log_end_msg 1 ;; *) log_end_msg 1 ;; esac ;; restart) log_daemon_msg "Restarting $DESC" "$NAME" do_stop case "$?" in 0|100|103) do_start case "$?" in 0|100) log_end_msg 0 ;; 103) log_progress_msg "was found dead" && log_end_msg 0 ;; *) log_end_msg 1 ;; esac ;; *) log_end_msg 1 ;; esac ;; status) do_status case "$?" in 0) exit 0 ;; 101) exit 3 ;; 103) exit 1 ;; *) exit 4 ;; esac ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2 exit 3 ;; esac :