]> git.pld-linux.org Git - packages/LPRng.git/blobdiff - lpd.init
- updated to 3.8.25, updated pl.po patch
[packages/LPRng.git] / lpd.init
index 4d573ed580d8d770f4e141949c9822f7a363bf91..c6fd70ed663dfb286664d7e54ce2999d14001f52 100644 (file)
--- a/lpd.init
+++ b/lpd.init
@@ -1,54 +1,75 @@
 #!/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
-# description: lpd is the print daemon required for lpr to work properly. \
-#   It is basically a server that arbitrates print jobs to printer(s).
-# processname: lpd
-# config: /etc/printcap
+# chkconfig:   2345 60 60
+#
+# description: lpd is the print daemon required for lpr to work properly. \
+#              It is basically a server that arbitrates print jobs to printer(s).
+#
+# processname: lpd
+# config:      /etc/printcap
+
 
-# Source function library.
+# Source function library
 . /etc/rc.d/init.d/functions
 
-# Source networking configuration.
+# Get network config
 . /etc/sysconfig/network
 
-# Check that networking is up.
-[ "${NETWORKING}" = "no" ] && exit 0
-
-[ -f /usr/sbin/lpd ] || exit 0
+# Get service config
+[ -f /etc/sysconfig/lpd ] && . /etc/sysconfig/lpd
 
-[ -f /etc/printcap ] || exit 0
-
-# Try get sysconfig ..
-if [ -f /etc/sysconfig/lpd ]; then
-    . /etc/sysconfig/lpd
-fi    
+# Check that networking is up.
+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 1
 
+RETVAL=0
 # See how we were called.
 case "$1" in
   start)
-        show "Starting lpd"
-        daemon lpd
-        touch /var/lock/subsys/lpd
-        ;;
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/lpd ]; then
+               msg_starting Lpd
+               daemon lpd
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lpd
+       else
+               msg_already_running Lpd
+       fi
+       ;;
   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|restart|reload|status}"
-        exit 1
+       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       exit 3
 esac
 
-exit 0
+exit $RETVAL
This page took 0.065732 seconds and 4 git commands to generate.