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

(-)syslog-ng (-12 / +40 lines)
Lines 5-10 Link Here
5
5
6
opts="depend checkconfig start stop reload"
6
opts="depend checkconfig start stop reload"
7
7
8
DAEMONTOOLSDIR="/var/daemontools/syslog-ng"
9
8
depend() {
10
depend() {
9
	need clock hostname
11
	need clock hostname
10
	provide logger
12
	provide logger
Lines 19-43 Link Here
19
}
21
}
20
22
21
start() {
23
start() {
22
    checkconfig || return 1
24
	checkconfig || return 1
23
    ebegin "Starting syslog-ng"
25
	if [ -x /usr/bin/svc ] && [ -x "${DAEMONTOOLSDIR}/run" ] \
24
    start-stop-daemon --start --quiet --exec /usr/sbin/syslog-ng
26
		&& [ ! -f "${DAEMONTOOLSDIR}/noinit" ]
27
	then
28
		ebegin "Starting supervised syslog-ng"
29
		/usr/bin/pgrphack /usr/bin/supervise "$DAEMONTOOLSDIR" | \
30
			/usr/bin/pgrphack /usr/bin/supervise "$DAEMONTOOLSDIR"/log &
31
	else
32
		ebegin "Starting syslog-ng"
33
		start-stop-daemon --start --quiet --exec /usr/sbin/syslog-ng
34
	fi
25
    eend $? "Failed to start syslog-ng"
35
    eend $? "Failed to start syslog-ng"
26
}
36
}
27
37
28
stop() {
38
stop() {
29
    ebegin "Stopping syslog-ng"
39
	ebegin "Stopping syslog-ng"
30
    start-stop-daemon --stop --quiet --pidfile /var/run/syslog-ng.pid
40
	if [ -x /usr/bin/svok ] && /usr/bin/svok "$DAEMONTOOLSDIR"
31
    eend $? "Failed to stop syslog-ng"
41
	then
32
    sleep 1 # needed for syslog-ng to stop in case we're restarting
42
		/usr/bin/svc -dx "$DAEMONTOOLSDIR" "$DAEMONTOOLSDIR"/log
43
	else
44
		start-stop-daemon --stop --quiet --pidfile /var/run/syslog-ng.pid
45
	fi
46
	eend $? "Failed to stop syslog-ng"
47
	sleep 1 # needed for syslog-ng to stop in case we're restarting
33
}
48
}
34
49
35
reload() {
50
reload() {
36
	if [ ! -f /var/run/syslog-ng.pid ]; then
37
		eerror "syslog-ng isn't running"
38
		return 1
39
	fi
40
	ebegin "Reloading configuration and re-opening log files"
51
	ebegin "Reloading configuration and re-opening log files"
41
	kill -HUP `cat /var/run/syslog-ng.pid` &>/dev/null
52
	if [ -x /usr/bin/svok ] && /usr/bin/svok "$DAEMONTOOLSDIR"
53
	then
54
		/usr/bin/svc -h "$DAEMONTOOLSDIR"
55
	else
56
		if [ ! -f /var/run/syslog-ng.pid ]; then
57
			eerror "syslog-ng isn't running"
58
			return 1
59
		fi
60
		kill -HUP `cat /var/run/syslog-ng.pid` &>/dev/null
61
	fi
42
	eend $?
62
	eend $?
43
}
63
}
64
65
status() {
66
	if [ -x /usr/bin/svok ] && /usr/bin/svok "$DAEMONTOOLSDIR"
67
	then
68
		einfo `/usr/bin/svstat "$DAEMONTOOLSDIR"`
69
		einfo `/usr/bin/svstat "${DAEMONTOOLSDIR}/log"`
70
	fi
71
}

Return to bug 28945