aboutsummaryrefslogtreecommitdiffstats
path: root/main/syslog-ng/syslog-ng.initd
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2019-01-26 22:11:57 +0100
committerJakub Jirutka <jakub@jirutka.cz>2019-01-26 23:20:28 +0100
commitd7b0f50b70742bb36bd3060552f0b98314c1b48b (patch)
treebee685bb721dd69f18814faddee4e3d98f489b6b /main/syslog-ng/syslog-ng.initd
parenta0b129e51bb92d043d5b0b9f1c0d6def56ded541 (diff)
downloadaports-d7b0f50b70742bb36bd3060552f0b98314c1b48b.tar.gz
aports-d7b0f50b70742bb36bd3060552f0b98314c1b48b.tar.bz2
aports-d7b0f50b70742bb36bd3060552f0b98314c1b48b.tar.xz
main/syslog-ng: rewrite init script
Diffstat (limited to 'main/syslog-ng/syslog-ng.initd')
-rw-r--r--[-rwxr-xr-x]main/syslog-ng/syslog-ng.initd51
1 files changed, 31 insertions, 20 deletions
diff --git a/main/syslog-ng/syslog-ng.initd b/main/syslog-ng/syslog-ng.initd
index 38144142f8..9a3dc47a58 100755..100644
--- a/main/syslog-ng/syslog-ng.initd
+++ b/main/syslog-ng/syslog-ng.initd
@@ -1,35 +1,46 @@
#!/sbin/openrc-run
-# Copyright 1999-2007 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-extra_commands="update"
+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
}
-start() {
- ebegin "Starting syslog-ng"
- start-stop-daemon --start --quiet --pidfile /run/syslog-ng.pid --exec /usr/sbin/syslog-ng -- --process-mode background
- eend $?
-}
-
-stop() {
- ebegin "Stopping syslog-ng"
- start-stop-daemon --stop --quiet --pidfile /run/syslog-ng.pid
- eend $?
+checkconfig() {
+ ebegin "Checking $RC_SVCNAME configuration"
+ syslog-ng -s -f "$cfgfile"
+ eend $? "Configuration error. Please fix your configfile ($cfgfile)"
}
reload() {
- if [ ! -f /run/syslog-ng.pid ]
- then
- eerror "syslog-ng not running!"
- return 1
- fi
- ebegin "Reloading syslog-ng"
- start-stop-daemon --signal HUP --pidfile /run/syslog-ng.pid --exec /usr/sbin/syslog-ng
+ checkconfig || return 1
+
+ ebegin "Reloading configuration and re-opening log files"
+ start-stop-daemon --signal HUP --pidfile "$pidfile"
eend $?
}