package.mk/wip/syslog-ng/syslog-ng.initd

47 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

#!/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 $?
}