Contents of /trunk/lprng/lprng.rc
Parent Directory | Revision Log
Revision 1300 -
(show annotations)
(download)
Wed Mar 9 21:40:14 2011 UTC (13 years, 6 months ago) by niro
File size: 1063 byte(s)
Wed Mar 9 21:40:14 2011 UTC (13 years, 6 months ago) by niro
File size: 1063 byte(s)
use current pidfile to stop the lpd server
1 | #!/bin/sh |
2 | # $Header: /root/magellan-cvs/src/lprng/lprng.rc,v 1.2 2008-06-10 22:19:59 niro Exp $ |
3 | |
4 | #%rlevels: 3:s 0:k |
5 | #%start: 23 |
6 | #%stop: 00 |
7 | |
8 | #deps |
9 | #%needs: |
10 | #%before: |
11 | #%after: |
12 | |
13 | source /etc/conf.d/rc |
14 | source ${rc_functions} |
15 | |
16 | pidfile() |
17 | { |
18 | local port |
19 | local lockfile |
20 | local config="/etc/lprng/lpd.conf" |
21 | |
22 | port=$(grep "^[[:space:]]*lpd_port" ${config} | cut -d "=" -f2) |
23 | [[ -z ${port} ]] && port="515" |
24 | |
25 | lockfile=$(grep "^[[:space:]]*lockfile" ${config} | cut -d "=" -f2) |
26 | [[ -z ${lockfile} ]] && lockfile="/var/run/lpd" |
27 | |
28 | echo "${lockfile}.${port}" |
29 | } |
30 | |
31 | case $1 in |
32 | start) |
33 | rc_print "Starting LPRng Printserver ..." |
34 | start-stop-daemon --start --quiet --exec /usr/sbin/lpd |
35 | |
36 | update_svcstatus $1 |
37 | splash svc_started "$(basename $0)" 0 |
38 | ;; |
39 | |
40 | stop) |
41 | rc_print "Stopping LPRng Printserver ..." |
42 | start-stop-daemon --stop --quiet --pidfile $(pidfile) |
43 | |
44 | update_svcstatus $1 |
45 | splash svc_stopped "$(basename $0)" 0 |
46 | ;; |
47 | |
48 | restart) |
49 | $0 stop |
50 | sleep 1 |
51 | $0 start |
52 | ;; |
53 | |
54 | status) |
55 | statusproc lpd |
56 | ;; |
57 | |
58 | *) |
59 | rc_echo "Usage: $0 {start|stop|restart|status}" |
60 | exit 1 |
61 | ;; |
62 | esac |