diff options
Diffstat (limited to 'community/vnstat/vnstatd.initd')
-rw-r--r-- | community/vnstat/vnstatd.initd | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/community/vnstat/vnstatd.initd b/community/vnstat/vnstatd.initd index 8a6e7ed91ac..5a829ba0172 100644 --- a/community/vnstat/vnstatd.initd +++ b/community/vnstat/vnstatd.initd @@ -1,19 +1,22 @@ #!/sbin/openrc-run -# Copyright 1999-2012 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -supervisor=supervise-daemon -name=vnstat +extra_started_commands="reload" description="Daemon based database updating for vnStat" -command=/usr/sbin/vnstatd -command_args="$VNSTATD_EXTRAOPTS" -command_args_foreground="--nodaemon" +: ${cfgfile:="/etc/vnstat.conf"} +: ${command_user:="vnstat:vnstat"} +# VNSTATD_NICELEVEL is here for backward compatibility only +: ${nicelevel:=${VNSTATD_NICELEVEL:-0}} -command_user=vnstat:vnstat -supervise_daemon_args="--nicelevel ${VNSTATD_NICELEVEL:-0}" +command=/usr/sbin/vnstatd +# $VNSTATD_EXTRAOPTS is here for backward compatibility only +command_args="--nodaemon --config $cfgfile ${command_args:-$VNSTATD_EXTRAOPTS}" +command_background="yes" +pidfile="/run/$RC_SVCNAME.pid" +start_stop_daemon_args="--nicelevel $nicelevel" +supervise_daemon_args="$start_stop_daemon_args" -extra_started_commands="reload" +required_files="$cfgfile" depend() { use net @@ -24,7 +27,11 @@ start_pre() { } reload() { - ebegin "Reloading vnstatd configuration" - $supervisor $RC_SVCNAME --signal HUP + ebegin "Reloading $RC_SVCNAME configuration" + if [ "$supervisor" ]; then + $supervisor "$RC_SVCNAME" --signal HUP + else + start-stop-daemon --pidfile "$pidfile" --signal HUP + fi eend $? } |