]>
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. |
bfcac710 | 25 | if [ "${NETWORKING}" = "no" ]; then |
26 | echo "WARNING: Networking is down. Lpd can't be runed." | |
27 | exit 1 | |
28 | fi | |
1251c2e5 | 29 | |
9c901b87 | 30 | # Sanity check |
1251c2e5 | 31 | [ -f /etc/printcap ] || exit 0 |
32 | ||
1251c2e5 | 33 | |
34 | # See how we were called. | |
35 | case "$1" in | |
36 | start) | |
9c901b87 | 37 | # Check if the service is already running? |
38 | if [ ! -f /var/lock/subsys/lpd ]; then | |
39 | show Starting lpd | |
40 | daemon lpd | |
41 | else | |
42 | echo "lpd already is running" | |
43 | fi | |
1251c2e5 | 44 | touch /var/lock/subsys/lpd |
45 | ;; | |
46 | stop) | |
d5e2590a | 47 | show "Shutting down lpd" |
1251c2e5 | 48 | killproc lpd |
49 | rm -f /var/lock/subsys/lpd | |
50 | ;; | |
51 | status) | |
52 | status lpd | |
53 | ;; | |
54 | restart|reload) | |
55 | $0 stop | |
56 | $0 start | |
57 | ;; | |
58 | *) | |
9c901b87 | 59 | echo "Usage: $0 {start|stop|status|restart|reload}" |
1251c2e5 | 60 | exit 1 |
61 | esac | |
62 | ||
63 | exit 0 |