#!/bin/sh
#
-# lpd This shell script takes care of starting and stopping
-# lpd (printer daemon).
+# lpd This shell script takes care of starting and stopping
+# lpd (printer daemon).
#
# chkconfig: 2345 60 60
#
[ -f /etc/sysconfig/lpd ] && . /etc/sysconfig/lpd
# Check that networking is up.
-[ "${NETWORKING}" = "no" ] && echo "Error: Networking is down" && exit 0
-
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+ msg_network_down Lpd
+ exit 1
+ fi
+else
+ exit 0
+fi
+
# Sanity check
-[ -f /etc/printcap ] || exit 0
-
+[ -f /etc/printcap ] || exit 1
+RETVAL=0
# See how we were called.
case "$1" in
start)
# Check if the service is already running?
if [ ! -f /var/lock/subsys/lpd ]; then
- show Starting lpd
+ msg_starting Lpd
daemon lpd
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lpd
else
- echo "lpd already is running"
+ msg_already_running Lpd
fi
- touch /var/lock/subsys/lpd
- ;;
+ ;;
stop)
- show "Shutting down lpd"
- killproc lpd
- rm -f /var/lock/subsys/lpd
- ;;
+ # Stop daemons.
+ if [ -f /var/lock/subsys/lpd ]; then
+ msg_stopping Lpd
+ killproc lpd
+ rm -f /var/lock/subsys/lpd >/dev/null 2>&1
+ else
+ msg_not_running Lpd
+ fi
+ ;;
status)
status lpd
+ exit $?
;;
- restart|reload)
+ restart|force-reload)
$0 stop
$0 start
+ exit $?
;;
*)
- echo "Usage: $0 {start|stop|status|restart|reload}"
- exit 1
+ msg_usage "$0 {start|stop|restart|force-reload|status}"
+ exit 3
esac
-exit 0
+exit $RETVAL