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