]>
Commit | Line | Data |
---|---|---|
1251c2e5 | 1 | #!/bin/sh |
2 | # | |
3 | # lpd This shell script takes care of starting and stopping | |
4 | # lpd (printer daemon). | |
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. |
8d3804f0 | 25 | if is_no "${NETWORKING}"; then |
26 | msg_Network_Down Lpd | |
27 | exit 1 | |
bfcac710 | 28 | fi |
8d3804f0 | 29 | |
9c901b87 | 30 | # Sanity check |
8d3804f0 | 31 | [ -f /etc/printcap ] || exit 1 |
1251c2e5 | 32 | |
33 | # See how we were called. | |
34 | case "$1" in | |
35 | start) | |
9c901b87 | 36 | # Check if the service is already running? |
8d3804f0 | 37 | if [ ! -f /var/lock/subsys/lpd ]; then |
38 | msg_starting Lpd | |
39 | daemon lpd | |
40 | RETVAL=$? | |
41 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lpd | |
42 | else | |
43 | msg_Already_Running Lpd | |
44 | exit 1 | |
45 | fi | |
1251c2e5 | 46 | ;; |
47 | stop) | |
8d3804f0 | 48 | # Stop daemons. |
49 | if [ -f /var/lock/subsys/lpd ]; then | |
50 | msg_stopping Lpd | |
51 | killproc lpd | |
52 | rm -f /var/lock/subsys/lpd >/dev/null 2>&1 | |
53 | else | |
54 | msg_Not_Running Lpd | |
55 | exit 1 | |
56 | fi | |
1251c2e5 | 57 | ;; |
58 | status) | |
59 | status lpd | |
8d3804f0 | 60 | exit $? |
1251c2e5 | 61 | ;; |
8d3804f0 | 62 | restart) |
1251c2e5 | 63 | $0 stop |
64 | $0 start | |
65 | ;; | |
66 | *) | |
8d3804f0 | 67 | msg_Usage "$0 {start|stop|status|restart}" |
1251c2e5 | 68 | exit 1 |
69 | esac | |
70 | ||
8d3804f0 | 71 | exit $RETVAL |