]>
Commit | Line | Data |
---|---|---|
1251c2e5 | 1 | #!/bin/sh |
2 | # | |
aece03f3 | 3 | # lpd This shell script takes care of starting and stopping |
4 | # lpd (printer daemon). | |
1251c2e5 | 5 | # |
9c901b87 | 6 | # chkconfig: 2345 60 60 |
7 | # | |
8 | # description: 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 | ||
1251c2e5 | 14 | |
9c901b87 | 15 | # Source function library |
1251c2e5 | 16 | . /etc/rc.d/init.d/functions |
17 | ||
9c901b87 | 18 | # Get network config |
1251c2e5 | 19 | . /etc/sysconfig/network |
20 | ||
9c901b87 | 21 | # Get service config |
22 | [ -f /etc/sysconfig/lpd ] && . /etc/sysconfig/lpd | |
1251c2e5 | 23 | |
9c901b87 | 24 | # Check that networking is up. |
aece03f3 | 25 | if is_yes "${NETWORKING}"; then |
26 | if [ ! -f /var/lock/subsys/network ]; then | |
27 | msg_network_down Lpd | |
28 | exit 1 | |
29 | fi | |
30 | else | |
31 | exit 0 | |
bfcac710 | 32 | fi |
8d3804f0 | 33 | |
9c901b87 | 34 | # Sanity check |
8d3804f0 | 35 | [ -f /etc/printcap ] || exit 1 |
1251c2e5 | 36 | |
37 | # See how we were called. | |
38 | case "$1" in | |
39 | start) | |
9c901b87 | 40 | # Check if the service is already running? |
aece03f3 | 41 | if [ ! -f /var/lock/subsys/lpd ]; then |
42 | msg_starting Lpd | |
43 | daemon lpd | |
44 | RETVAL=$? | |
45 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lpd | |
46 | else | |
47 | msg_already_running Lpd | |
48 | exit 1 | |
49 | fi | |
50 | ;; | |
1251c2e5 | 51 | stop) |
aece03f3 | 52 | # Stop daemons. |
53 | if [ -f /var/lock/subsys/lpd ]; then | |
54 | msg_stopping Lpd | |
55 | killproc lpd | |
56 | rm -f /var/lock/subsys/lpd >/dev/null 2>&1 | |
57 | else | |
58 | msg_not_running Lpd | |
59 | exit 1 | |
60 | fi | |
61 | ;; | |
1251c2e5 | 62 | status) |
63 | status lpd | |
8d3804f0 | 64 | exit $? |
1251c2e5 | 65 | ;; |
aece03f3 | 66 | restart|reload) |
1251c2e5 | 67 | $0 stop |
68 | $0 start | |
69 | ;; | |
70 | *) | |
aece03f3 | 71 | msg_usage "$0 {start|stop|restart|reload|status}" |
72 | exit 1 | |
1251c2e5 | 73 | esac |
74 | ||
8d3804f0 | 75 | exit $RETVAL |