]>
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 |
22ddf361 | 26 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
aece03f3 | 27 | msg_network_down Lpd |
28 | exit 1 | |
29 | fi | |
30 | else | |
31 | exit 0 | |
bfcac710 | 32 | fi |
635c1e29 | 33 | |
9c901b87 | 34 | # Sanity check |
8d3804f0 | 35 | [ -f /etc/printcap ] || exit 1 |
1251c2e5 | 36 | |
0799e453 | 37 | RETVAL=0 |
1251c2e5 | 38 | # See how we were called. |
39 | case "$1" in | |
40 | start) | |
9c901b87 | 41 | # Check if the service is already running? |
aece03f3 | 42 | if [ ! -f /var/lock/subsys/lpd ]; then |
43 | msg_starting Lpd | |
44 | daemon lpd | |
45 | RETVAL=$? | |
46 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lpd | |
47 | else | |
48 | msg_already_running Lpd | |
aece03f3 | 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 | |
aece03f3 | 59 | fi |
60 | ;; | |
1251c2e5 | 61 | status) |
62 | status lpd | |
8d3804f0 | 63 | exit $? |
1251c2e5 | 64 | ;; |
0799e453 | 65 | restart|force-reload) |
1251c2e5 | 66 | $0 stop |
67 | $0 start | |
0799e453 | 68 | exit $? |
1251c2e5 | 69 | ;; |
70 | *) | |
0799e453 | 71 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
72 | exit 3 | |
1251c2e5 | 73 | esac |
74 | ||
8d3804f0 | 75 | exit $RETVAL |