Annotation of /trunk/syslog-ng/syslog-ng.rc
Parent Directory | Revision Log
Revision 1040 -
(hide annotations)
(download)
Wed May 5 13:53:35 2010 UTC (14 years, 4 months ago) by niro
File size: 1256 byte(s)
Wed May 5 13:53:35 2010 UTC (14 years, 4 months ago) by niro
File size: 1256 byte(s)
- no quiet, tell start-stop-daemon where the pidfile is - style updates
1 | niro | 153 | #!/bin/bash |
2 | |||
3 | #%rlevels: 0:k 1:k 2:k 3:s 4:s 5:s 6:k | ||
4 | #%start: 10 | ||
5 | #%stop: 20 | ||
6 | |||
7 | #deps | ||
8 | #%needs: | ||
9 | #%before: | ||
10 | #%after: | ||
11 | |||
12 | niro | 724 | source /etc/conf.d/rc |
13 | niro | 153 | source $rc_functions |
14 | |||
15 | niro | 1040 | die() |
16 | { | ||
17 | niro | 153 | echo "Error: $@" |
18 | exit 1 | ||
19 | } | ||
20 | |||
21 | |||
22 | niro | 1040 | checkconfig() |
23 | { | ||
24 | niro | 153 | if [ ! -e /etc/syslog-ng/syslog-ng.conf ] |
25 | then | ||
26 | die "You need to create /etc/syslog-ng/syslog-ng.conf first." | ||
27 | fi | ||
28 | niro | 909 | syslog-ng -s -f /etc/syslog-ng/syslog-ng.conf || \ |
29 | niro | 153 | die "Configuration error. Please fix your configfile (/etc/syslog-ng/syslog-ng.conf)" |
30 | } | ||
31 | |||
32 | |||
33 | case "$1" in | ||
34 | start) | ||
35 | checkconfig || exit 1 | ||
36 | |||
37 | echo -e ${COLOREDSTAR}"Starting syslog-ng daemon ..." | ||
38 | niro | 1040 | start-stop-daemon --start --pidfile /var/run/syslog-ng.pid --exec /usr/sbin/syslog-ng |
39 | niro | 153 | evaluate_retval |
40 | |||
41 | update_svcstatus $1 | ||
42 | splash svc_started "$(basename $0)" 0 | ||
43 | ;; | ||
44 | |||
45 | stop) | ||
46 | echo -e ${COLOREDSTAR}"Stopping syslog-ng daemon ..." | ||
47 | start-stop-daemon --stop --quiet --pidfile /var/run/syslog-ng.pid | ||
48 | evaluate_retval | ||
49 | |||
50 | update_svcstatus $1 | ||
51 | splash svc_stopped "$(basename $0)" 0 | ||
52 | ;; | ||
53 | |||
54 | reload) | ||
55 | checkconfig || exit 1 | ||
56 | echo -e ${COLOREDSTAR}"Reloading syslog-ng daemon ..." | ||
57 | reloadproc /usr/sbin/syslog-ng | ||
58 | ;; | ||
59 | |||
60 | restart) | ||
61 | $0 stop | ||
62 | sleep 1 | ||
63 | $0 start | ||
64 | ;; | ||
65 | |||
66 | status) | ||
67 | niro | 271 | statusproc syslog-ng |
68 | niro | 153 | ;; |
69 | |||
70 | *) | ||
71 | niro | 1040 | echo "Usage: $0 {start|stop|reload|restart|status}" |
72 | niro | 153 | exit 1 |
73 | ;; | ||
74 | esac |