aboutsummaryrefslogtreecommitdiffstats
path: root/main/syslog-ng/syslog-ng.initd
blob: 9a3dc47a58e33a1ba7f4a04bf1adb22a192067ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/sbin/openrc-run

extra_commands="checkconfig"
extra_started_commands="reload"

description_checkconfig="Check the configuration file"
description_reload="Reload the configuration without exiting"

: ${cfgfile:="/etc/syslog-ng/$RC_SVCNAME.conf"}
: ${statedir:="/var/lib/syslog-ng"}
: ${control_file:="$statedir/$RC_SVCNAME.ctl"}
: ${persist_file:="$statedir/$RC_SVCNAME.persist"}

pidfile="/run/$RC_SVCNAME.pid"
command="/usr/sbin/syslog-ng"
command_args="
	--cfgfile $cfgfile
	--control $control_file
	--persist-file $persist_file
	--pidfile $pidfile
	$command_args"

required_files="$cfgfile"
required_dirs="$statedir"

depend() {
	use clock
	need hostname localmount
	before net
	after bootmisc
	provide logger
}

checkconfig() {
	ebegin "Checking $RC_SVCNAME configuration"
	syslog-ng -s -f "$cfgfile"
	eend $? "Configuration error. Please fix your configfile ($cfgfile)"
}

reload() {
	checkconfig || return 1

	ebegin "Reloading configuration and re-opening log files"
	start-stop-daemon --signal HUP --pidfile "$pidfile"
	eend $?
}