]> git.pld-linux.org Git - packages/LPRng.git/blob - LPRng.init
- fix re-entrant install, make -j1, drop obsolete comment
[packages/LPRng.git] / LPRng.init
1 #!/bin/sh
2 #
3 # LPRng         This shell script takes care of starting and stopping
4 #               LPRng lpd (printer daemon).
5 #
6 # chkconfig:    2345 60 60
7 #
8 # description:  LPRng lpd is the print daemon required for lpr to work properly. \
9 #               It is basically a server that arbitrates print jobs to printer(s).
10 #
11 # processname:  lpd
12 # config:       /etc/printcap
13
14
15 # Source function library
16 . /etc/rc.d/init.d/functions
17
18 # Get network config
19 . /etc/sysconfig/network
20
21 # Get service config
22 [ -f /etc/sysconfig/lpd ] && . /etc/sysconfig/lpd
23
24 # Check that networking is up.
25 if is_yes "${NETWORKING}"; then
26         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
27                 msg_network_down LPRng
28                 exit 1
29         fi
30 else
31         exit 0
32 fi
33
34 # Sanity check
35 [ -f /etc/printcap ] || exit 0
36
37 RETVAL=0
38 # See how we were called.
39 case "$1" in
40   start)
41         # Check if the service is already running?
42         if [ ! -f /var/lock/subsys/lpd ]; then
43                 msg_starting LPRng
44                 daemon lpd
45                 RETVAL=$?
46                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lpd
47         else
48                 msg_already_running "LPRng"
49         fi
50         ;;
51   stop)
52         if [ -f /var/lock/subsys/lpd ]; then
53                 msg_stopping "LPRng"
54                 killproc lpd
55                 rm -f /var/lock/subsys/lpd >/dev/null 2>&1
56         else
57                 msg_not_running "LPRng"
58         fi
59         ;;
60   status)
61         status lpd
62         exit $?
63         ;;
64   restart|force-reload)
65         $0 stop
66         $0 start
67         exit $?
68         ;;
69   *)
70         msg_usage "$0 {start|stop|restart|force-reload|status}"
71         exit 3
72 esac
73
74 exit $RETVAL
This page took 0.038885 seconds and 3 git commands to generate.