Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 228973
Collapse All | Expand All

(-)files/syslog-ng.confd (+26 lines)
Lines 1-5 Link Here
1
# Config file for /etc/init.d/syslog-ng
1
# Config file for /etc/init.d/syslog-ng
2
2
3
# If you are not using network logging, this entire section should be
4
# commented out. Otherwise, choose one of the settings below based on
5
# how you are configuring your network.
6
#
7
# If you are using the net.* scripts to configure your network, you should
8
# set rc_need to match the interface through which your logging server
9
# can be reached.
10
#rc_need="net.eth0"
11
#
12
# If you are using an interface manager like wicd, dhcpcd in standalone
13
# mode, networkmanager, etc to control your interfaces, set rc_need to
14
# the name of that service.
15
# rc_need="dhcpcd"
16
#rc_need="networkmanager"
17
#
18
# If you are using newnet and configuring your interface statically with
19
# the network script, you should use this setting.
20
#rc_need="network"
21
#
22
# You can use this setting, but I do not recommend relying on it.
23
#rc_need="net"
24
#
25
# You may also want to uncomment the following if you are using network
26
# logging.
27
#rc_use="stunnel"
28
3
# Put any additional options for syslog-ng here.
29
# Put any additional options for syslog-ng here.
4
# See syslog-ng(8) for more information.
30
# See syslog-ng(8) for more information.
5
31
(-)files/syslog-ng.rc6.3.3 (-35 / +12 lines)
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
}

Return to bug 228973