]>
Commit | Line | Data |
---|---|---|
03de21a2 | 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 [ "${NETWORKING}" = "no" ]; then | |
58a87e19 | 26 | echo "WARNING: Networking is down. LPRng lpd can't be run." |
03de21a2 | 27 | exit 1 |
28 | fi | |
29 | ||
30 | # Sanity check | |
31 | [ -f /etc/printcap ] || exit 0 | |
32 | ||
33 | ||
34 | # See how we were called. | |
35 | case "$1" in | |
36 | start) | |
37 | # Check if the service is already running? | |
38 | if [ ! -f /var/lock/subsys/lpd ]; then | |
39 | msg_starting LPRng | |
40 | daemon lpd | |
41 | RETVAL=$? | |
42 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lpd | |
43 | else | |
44 | msg_Already_Running "LPRng" | |
45 | exit 1 | |
46 | fi | |
47 | ;; | |
48 | stop) | |
49 | if [ -f /var/lock/subsys/lpd ]; then | |
50 | msg_stopping "LPRng" | |
51 | killproc lpd | |
52 | rm -f /var/lock/subsys/lpd >/dev/null 2>&1 | |
53 | else | |
54 | msg_Not_Running "LPRng" | |
55 | exit 1 | |
56 | fi | |
57 | ;; | |
58 | status) | |
59 | status lpd | |
60 | exit $? | |
61 | ;; | |
62 | restart|reload) | |
63 | $0 stop | |
64 | $0 start | |
65 | ;; | |
66 | *) | |
67 | msg_Usage "$0 {start|stop|status|restart|reload}" | |
68 | exit 1 | |
69 | esac | |
70 | ||
71 | exit $RETVAL |