# 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." <service>
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
msg_network_down sockdd
exit 1
fi
exit 0
fi
-
-# 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
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/sockd
else
msg_already_running sockd
- exit 1
fi
- ;;
- stop)
- # Stop daemons.
+}
+
+stop() {
if [ -f /var/lock/subsys/sockd ]; then
msg_stopping sockd
killproc sockd
- RETVAL=$?
rm -f /var/lock/subsys/sockd /var/run/sockd.pid >/dev/null 2>&1
else
msg_not_running sockd
- exit 1
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
;;
- status)
- status sockd
- exit $?
+ stop)
+ stop
;;
- restart|reload)
- $0 stop
- $0 start
- exit $?
+ restart)
+ stop
+ start
+ ;;
+ try-restart)
+ condrestart 0
;;
force-reload)
- $0 stop && $0 start
+ condrestart 7
+ ;;
+ status)
+ status sockd
exit $?
;;
*)
- msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
- exit 1
- ;;
+ msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+ exit 3
esac
exit $RETVAL