X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=debian%2Fmetaproxy.init;h=67743dd7fc780d76af263d32da059121a53e7682;hb=586d78659d671683f33ec55f4a7d32b28e345ccd;hp=0f36bdda377e5a0f4b02ea8a89534cbac68f4df1;hpb=c4c8c06091cdee7a042ad9ac75401951d090e94d;p=metaproxy-moved-to-github.git diff --git a/debian/metaproxy.init b/debian/metaproxy.init index 0f36bdd..67743dd 100644 --- a/debian/metaproxy.init +++ b/debian/metaproxy.init @@ -22,6 +22,9 @@ SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 +# Read user information +. /etc/metaproxy/metaproxy.user + # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME @@ -78,7 +81,7 @@ do_stop() } # -# Function that sends a SIGHUP to the daemon/service +# Function that sends a SIGUSR1 to the daemon/service # do_reload() { # @@ -86,7 +89,17 @@ do_reload() { # restarting (for example, when it is sent a SIGHUP), # then implement that here. # - start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + start-stop-daemon --stop --signal USR1 --quiet --retry=5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + # Return if daemon could not be stopped + [ "$RETVAL" = 2 ] && return 2 + # daemon not running or stopped + rm -f $PIDFILE + # Return if it was not running, in which case we don't start it + [ "$RETVAL" = 1 ] && return 0 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_OPTS \ + || return 2 return 0 } @@ -113,16 +126,16 @@ case "$1" in ;; esac ;; - #reload|force-reload) + reload|force-reload) # # If do_reload() is not implemented then leave this commented out # and leave 'force-reload' as an alias for 'restart'. # - #log_daemon_msg "Reloading $DESC" "$NAME" - #do_reload - #log_end_msg $? - #;; - restart|force-reload) + log_daemon_msg "Reloading $DESC" "$NAME" + do_reload + log_end_msg $? + ;; + restart) # # If the "reload" option is implemented then remove the # 'force-reload' alias @@ -144,9 +157,11 @@ case "$1" in ;; esac ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; *) - #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2 exit 3 ;; esac