diff options
Diffstat (limited to 'sh/openrc-run.sh.in')
-rw-r--r-- | sh/openrc-run.sh.in | 75 |
1 files changed, 9 insertions, 66 deletions
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in index e279f116..4d286b2a 100644 --- a/sh/openrc-run.sh.in +++ b/sh/openrc-run.sh.in @@ -125,72 +125,6 @@ _status() fi } -# Template start / stop / status functions -start() -{ - [ -n "$command" ] || return 0 - local _background= - ebegin "Starting ${name:-$RC_SVCNAME}" - if yesno "${command_background}"; then - if [ -z "${pidfile}" ]; then - eend 1 "command_background option used but no pidfile specified" - return 1 - fi - _background="--background --make-pidfile" - fi - if yesno "$start_inactive"; then - local _inactive=false - service_inactive && _inactive=true - mark_service_inactive - fi - eval start-stop-daemon --start \ - --exec $command \ - ${chroot:+--chroot} $chroot \ - ${procname:+--name} $procname \ - ${pidfile:+--pidfile} $pidfile \ - $_background $start_stop_daemon_args \ - -- $command_args - if eend $? "Failed to start $RC_SVCNAME"; then - service_set_value "command" "${command}" - [ -n "${chroot}" ] && service_set_value "chroot" "${chroot}" - [ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}" - [ -n "${procname}" ] && service_set_value "procname" "${procname}" - return 0 - fi - if yesno "$start_inactive"; then - if ! $_inactive; then - mark_service_stopped - fi - fi - return 1 -} - -stop() -{ - local startcommand="$(service_get_value "command")" - local startchroot="$(service_get_value "chroot")" - local startpidfile="$(service_get_value "pidfile")" - local startprocname="$(service_get_value "procname")" - command="${startcommand:-$command}" - chroot="${startchroot:-$chroot}" - pidfile="${startpidfile:-$pidfile}" - procname="${startprocname:-$procname}" - [ -n "$command" -o -n "$procname" -o -n "$pidfile" ] || return 0 - ebegin "Stopping ${name:-$RC_SVCNAME}" - start-stop-daemon --stop \ - ${retry:+--retry} $retry \ - ${command:+--exec} $command \ - ${procname:+--name} $procname \ - ${pidfile:+--pidfile} $chroot$pidfile \ - ${stopsig:+--signal} $stopsig - eend $? "Failed to stop $RC_SVCNAME" -} - -status() -{ - _status -} - yesno $RC_DEBUG && set -x _conf_d=${RC_SERVICE%/*}/../conf.d @@ -212,6 +146,15 @@ unset _conf_d # Load any system overrides sourcex -e "@SYSCONFDIR@/rc.conf" +# load a service supervisor +sourcex "@LIBEXECDIR@/sh/start-stop-daemon.sh" +if [ -n "$rc_supervisor" ]; then + if ! sourcex -e "@LIBEXECDIR@/sh/${rc_supervisor}.sh"; then + ewarn "$rc_supervisor is an invalid value for rc_supervisor" + ewarn "Using the default." + fi +fi + # Set verbose mode if yesno "${rc_verbose:-$RC_VERBOSE}"; then EINFO_VERBOSE=yes |