Lines 3-31
Link Here
|
3 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
# $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.rc6.3.3,v 1.2 2011/10/19 06:19:38 mr_bones_ Exp $ |
4 |
# $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/syslog-ng.rc6.3.3,v 1.2 2011/10/19 06:19:38 mr_bones_ Exp $ |
5 |
|
5 |
|
|
|
6 |
command="syslog-ng" |
7 |
command_args="${SYSLOG_NG_OPTS}" |
6 |
extra_commands="checkconfig" |
8 |
extra_commands="checkconfig" |
7 |
extra_started_commands="reload" |
9 |
extra_started_commands="reload" |
|
|
10 |
pidfile="${SYSLOG_NG_PIDFILE:-/var/run/${RC_SVCNAME}.pid}" |
8 |
|
11 |
|
9 |
description_checkconfig="Check the configuration file that will be used by \"start\"" |
12 |
description_checkconfig="Check the configuration file that will be used by \"start\"" |
10 |
description_reload="Reload the configuration without exiting" |
13 |
description_reload="Reload the configuration without exiting" |
11 |
|
14 |
|
12 |
SYSLOG_NG_SERVICE=${SVCNAME#*.} |
15 |
SYSLOG_NG_CONFIGFILE=${SYSLOG_NG_CONFIGFILE:-/etc/syslog-ng/${RC_SVCNAME}.conf} |
13 |
SYSLOG_NG_SERVICE=${SYSLOG_NG_SERVICE:-syslog-ng} |
16 |
command_args="--cfgfile ${SYSLOG_NG_CONFIGFILE} --pidfile ${pidfile} ${command_args}" |
14 |
|
|
|
15 |
SYSLOG_NG_CONFIGFILE=${SYSLOG_NG_CONFIGFILE:-/etc/syslog-ng/${SYSLOG_NG_SERVICE}.conf} |
16 |
SYSLOG_NG_PIDFILE=${SYSLOG_NG_PIDFILE:-/var/run/${SVCNAME}.pid} |
17 |
SYSLOG_NG_OPTS="--cfgfile ${SYSLOG_NG_CONFIGFILE} --pidfile ${SYSLOG_NG_PIDFILE} ${SYSLOG_NG_OPTS}" |
18 |
|
17 |
|
19 |
depend() { |
18 |
depend() { |
20 |
# Make networking dependency conditional on configuration |
|
|
21 |
if [ -f "${SYSLOG_NG_CONFIGFILE}" ]; then |
22 |
case `sed 's/#.*//' "${SYSLOG_NG_CONFIGFILE}"` in |
23 |
*source*tcp*|*source*udp*|*destination*tcp*|*destination*udp*) |
24 |
need net |
25 |
use stunnel ;; |
26 |
esac |
27 |
fi |
28 |
|
29 |
config "${SYSLOG_NG_CONFIGFILE}" |
19 |
config "${SYSLOG_NG_CONFIGFILE}" |
30 |
use clock |
20 |
use clock |
31 |
need hostname localmount |
21 |
need hostname localmount |
Lines 36-73
Link Here
|
36 |
if [ ! -e "${SYSLOG_NG_CONFIGFILE}" ] ; then |
26 |
if [ ! -e "${SYSLOG_NG_CONFIGFILE}" ] ; then |
37 |
eerror "You need to create ${SYSLOG_NG_CONFIGFILE} first." |
27 |
eerror "You need to create ${SYSLOG_NG_CONFIGFILE} first." |
38 |
eerror "An example can be found in /usr/share/doc/syslog" |
28 |
eerror "An example can be found in /usr/share/doc/syslog" |
39 |
|
|
|
40 |
return 1 |
29 |
return 1 |
41 |
fi |
30 |
fi |
|
|
31 |
ebegin "Checking your configfile (${SYSLOG_NG_CONFIGFILE})" |
42 |
syslog-ng -s -f "${SYSLOG_NG_CONFIGFILE}" |
32 |
syslog-ng -s -f "${SYSLOG_NG_CONFIGFILE}" |
43 |
|
33 |
eend $? "Configuration error. Please fix your configfile (${SYSLOG_NG_CONFIGFILE})" |
44 |
# the start and reload functions have their own eends so |
|
|
45 |
# avoid calling this twice when there are no problems |
46 |
[ $? -eq 0 ] || eend $? "Configuration error. Please fix your configfile (${SYSLOG_NG_CONFIGFILE})" |
47 |
} |
34 |
} |
48 |
|
35 |
|
49 |
start() { |
36 |
start_pre() { |
50 |
checkconfig || return 1 |
37 |
checkconfig || return 1 |
51 |
ebegin "Starting ${SVCNAME}" |
|
|
52 |
[ -n "${SYSLOG_NG_OPTS}" ] && SYSLOG_NG_OPTS="-- ${SYSLOG_NG_OPTS}" |
53 |
start-stop-daemon --start --pidfile "${SYSLOG_NG_PIDFILE}" --exec /usr/sbin/syslog-ng ${SYSLOG_NG_OPTS} |
54 |
eend $? "Failed to start ${SVCNAME}" |
55 |
} |
38 |
} |
56 |
|
39 |
|
57 |
stop() { |
40 |
stop_post() { |
58 |
ebegin "Stopping ${SVCNAME}" |
41 |
[ "$RC_CMD" = restart ] && sleep 1 |
59 |
start-stop-daemon --stop --pidfile "${SYSLOG_NG_PIDFILE}" |
42 |
return 0 |
60 |
eend $? "Failed to stop ${SVCNAME}" |
|
|
61 |
sleep 1 # needed for syslog-ng to stop in case we're restarting |
62 |
} |
43 |
} |
63 |
|
44 |
|
64 |
reload() { |
45 |
reload() { |
65 |
if [ ! -f "${SYSLOG_NG_PIDFILE}" ]; then |
|
|
66 |
eerror "${SVCNAME} isn't running" |
67 |
return 1 |
68 |
fi |
69 |
checkconfig || return 1 |
46 |
checkconfig || return 1 |
70 |
ebegin "Reloading configuration and re-opening log files" |
47 |
ebegin "Reloading configuration and re-opening log files" |
71 |
start-stop-daemon --signal HUP --pidfile "${SYSLOG_NG_PIDFILE}" |
48 |
start-stop-daemon --signal HUP --pidfile "${pidfile}" |
72 |
eend $? |
49 |
eend $? |
73 |
} |
50 |
} |