summarylogtreecommitdiffstats
path: root/initscript_openrc
diff options
context:
space:
mode:
Diffstat (limited to 'initscript_openrc')
-rw-r--r--initscript_openrc30
1 files changed, 20 insertions, 10 deletions
diff --git a/initscript_openrc b/initscript_openrc
index c6b2bf215c1a..666d6fe88fe7 100644
--- a/initscript_openrc
+++ b/initscript_openrc
@@ -1,38 +1,48 @@
#!/usr/bin/openrc-run
# OpenRC wwwoffle script
-## The WWWOFFLE_ARGS environment variable should be set within /etc/conf.d/wwwoffle!
+## The controlling environment variable should be set within /etc/conf.d/wwwoffle!
_DAEMON="/usr/sbin/wwwoffled"
_DAEMON_ARGS=(
- ${WWWOFFLE_ARGS}
+ -c "${WWWOFFLE_CONFIG_FILE}"
+ ${WWWOFFLED_EXTRA_ARGS}
)
-extra_started_commands="reload"
+extra_started_commands="reload status"
depend() {
use logger dns
}
+_check_conf_file_var() {
+ if [ -z "${WWWOFFLE_CONFIG_FILE}" ]; then
+ eerror "Variable 'WWWOFFLE_CONFIG_FILE' not set or empty in '/etc/conf.d/wwwoffle'".
+ eerror "This variable needs to be set to the configuration file to use."
+ return 1
+ fi
+}
+
start() {
ebegin "Starting $(basename "${_DAEMON}"): Executing ${_DAEMON} ${_DAEMON_ARGS[@]}"
-
- start-stop-daemon --start --quiet --exec "${_DAEMON}" -- "${_DAEMON_ARGS[@]}"
-
+ _check_conf_file_var && start-stop-daemon --start --exec "${_DAEMON}" -- "${_DAEMON_ARGS[@]}"
eend "$?"
}
stop() {
ebegin "Stopping $(basename "${_DAEMON}")"
-
- start-stop-daemon --stop --quiet --exec "${_DAEMON}"
-
+ start-stop-daemon --stop --exec "${_DAEMON}"
eend "$?"
}
reload() {
ebegin "Re-reading configuration file for $(basename "${_DAEMON}")"
- wwwoffle "${_DAEMON_ARGS[@]}" -config
+ _check_conf_file_var && wwwoffle -c "${WWWOFFLE_CONFIG_FILE}" -config
eend "$?"
}
+status() {
+ ebegin "Querying status of $(basename "${_DAEMON}")"
+ _check_conf_file_var && wwwoffle -c "${WWWOFFLE_CONFIG_FILE}" -status
+ eend "$?"
+}