Annotation of /trunk/lprng/lprng.rc
Parent Directory | Revision Log
Revision 1300 -
(hide annotations)
(download)
Wed Mar 9 21:40:14 2011 UTC (13 years, 7 months ago) by niro
File size: 1063 byte(s)
Wed Mar 9 21:40:14 2011 UTC (13 years, 7 months ago) by niro
File size: 1063 byte(s)
use current pidfile to stop the lpd server
1 | niro | 632 | #!/bin/sh |
2 | niro | 650 | # $Header: /root/magellan-cvs/src/lprng/lprng.rc,v 1.2 2008-06-10 22:19:59 niro Exp $ |
3 | niro | 632 | |
4 | niro | 650 | #%rlevels: 3:s 0:k |
5 | niro | 632 | #%start: 23 |
6 | #%stop: 00 | ||
7 | |||
8 | #deps | ||
9 | #%needs: | ||
10 | #%before: | ||
11 | #%after: | ||
12 | |||
13 | niro | 650 | source /etc/conf.d/rc |
14 | source ${rc_functions} | ||
15 | niro | 632 | |
16 | niro | 1300 | 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 | niro | 632 | case $1 in |
32 | start) | ||
33 | niro | 1300 | rc_print "Starting LPRng Printserver ..." |
34 | niro | 632 | 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 | niro | 1300 | rc_print "Stopping LPRng Printserver ..." |
42 | start-stop-daemon --stop --quiet --pidfile $(pidfile) | ||
43 | niro | 632 | |
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 | niro | 1300 | rc_echo "Usage: $0 {start|stop|restart|status}" |
60 | niro | 632 | exit 1 |
61 | ;; | ||
62 | esac |