]>
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. | |
aece03f3 | 25 | if is_yes "${NETWORKING}"; then |
1967e0c9 | 26 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
aece03f3 | 27 | msg_network_down LPRng |
28 | exit 1 | |
29 | fi | |
30 | else | |
31 | exit 0 | |
03de21a2 | 32 | fi |
33 | ||
34 | # Sanity check | |
35 | [ -f /etc/printcap ] || exit 0 | |
36 | ||
e4a04cd1 | 37 | RETVAL=0 |
03de21a2 | 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 | |
2b575342 | 48 | msg_already_running "LPRng" |
03de21a2 | 49 | fi |
aece03f3 | 50 | ;; |
03de21a2 | 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 | |
2b575342 | 57 | msg_not_running "LPRng" |
03de21a2 | 58 | fi |
aece03f3 | 59 | ;; |
03de21a2 | 60 | status) |
61 | status lpd | |
62 | exit $? | |
63 | ;; | |
e4a04cd1 | 64 | restart|force-reload) |
03de21a2 | 65 | $0 stop |
66 | $0 start | |
e4a04cd1 | 67 | exit $? |
03de21a2 | 68 | ;; |
69 | *) | |
e4a04cd1 | 70 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
71 | exit 3 | |
03de21a2 | 72 | esac |
73 | ||
74 | exit $RETVAL |