diff options
author | felics@felics-tablet | 2016-09-21 19:45:28 +0200 |
---|---|---|
committer | felics@felics-tablet | 2016-09-21 19:45:28 +0200 |
commit | 35f3636021ed1bcfa121a97be1c2ed14f1b147a5 (patch) | |
tree | 426a683deb032c21ca57bd6fd51d0ebf21b0bf9b /initscript_openrc | |
parent | ce7309009c25f78d28d4f1f7190bf7b68496dda4 (diff) | |
download | aur-35f3636021ed1bcfa121a97be1c2ed14f1b147a5.tar.gz |
Rework of initscripts, initscripts' config file and install messages.
Diffstat (limited to 'initscript_openrc')
-rw-r--r-- | initscript_openrc | 30 |
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 "$?" +} |