X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=sockd.init;h=df5d55444b6bacbf564c0fc78876f51d8aa85ba7;hb=HEAD;hp=ce181a6062da2973059a2af834b1f56932cdf12f;hpb=2ae8fcc276a83b5ceca1639418af171d80e341ca;p=packages%2Fdante.git diff --git a/sockd.init b/sockd.init index ce181a6..df5d554 100644 --- a/sockd.init +++ b/sockd.init @@ -21,8 +21,7 @@ # Check that networking is up. if is_yes "${NETWORKING}"; then - if [ ! -f /var/lock/subsys/network ]; then - # nls "ERROR: Networking is down. %s can't be run." + if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then msg_network_down sockdd exit 1 fi @@ -30,10 +29,7 @@ else exit 0 fi -RETVAL=0 -# See how we were called. -case "$1" in - start) +start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/sockd ]; then msg_starting sockd @@ -43,9 +39,9 @@ case "$1" in else msg_already_running sockd fi - ;; - stop) - # Stop daemons. +} + +stop() { if [ -f /var/lock/subsys/sockd ]; then msg_stopping sockd killproc sockd @@ -53,18 +49,43 @@ case "$1" in else msg_not_running sockd fi +} + +condrestart() { + if [ ! -f /var/lock/subsys/sockd ]; then + msg_not_running sockd + RETVAL=$1 + return + fi + stop + start +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + try-restart) + condrestart 0 + ;; + force-reload) + condrestart 7 ;; status) status sockd exit $? ;; - restart|force-reload) - $0 stop - $0 start - exit $? - ;; *) - msg_usage "$0 {start|stop|restart|force-reload|status}" + msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" exit 3 esac