Rework supervisor integration framework
The original way of doing this allowed users to change the supervisor in conf.d/*. This changes this so that the supervisor setup can be done in the service script itself.
This commit is contained in:
parent
0198affc74
commit
a15fa1a3b1
@ -111,12 +111,6 @@
|
|||||||
# file, those characters should be replaced with underscores in the
|
# file, those characters should be replaced with underscores in the
|
||||||
# variable names as shown below.
|
# variable names as shown below.
|
||||||
|
|
||||||
# Set rc_supervisor to use a program to monitor your daemons and restart
|
|
||||||
# them when they crash.
|
|
||||||
# Leaving this undefined uses start-stop-daemon, which is OpenRC's
|
|
||||||
# default.
|
|
||||||
#rc_supervisor=""
|
|
||||||
|
|
||||||
# Some daemons are started and stopped via start-stop-daemon.
|
# Some daemons are started and stopped via start-stop-daemon.
|
||||||
# We can set some things on a per service basis, like the nicelevel.
|
# We can set some things on a per service basis, like the nicelevel.
|
||||||
#SSD_NICELEVEL="-19"
|
#SSD_NICELEVEL="-19"
|
||||||
|
@ -125,6 +125,42 @@ _status()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Template start / stop / status functions
|
||||||
|
# These functions select the appropriate function to call from the
|
||||||
|
# supervisor modules
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
local func=ssd_start
|
||||||
|
case "$supervisor" in
|
||||||
|
?*)
|
||||||
|
ewarn "Invalid supervisor, \"$supervisor\", using start-stop-daemon"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
$func
|
||||||
|
}
|
||||||
|
|
||||||
|
stop()
|
||||||
|
{
|
||||||
|
local func=ssd_stop
|
||||||
|
case "$supervisor" in
|
||||||
|
?*)
|
||||||
|
ewarn "Invalid supervisor, \"$supervisor\", using start-stop-daemon"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
$func
|
||||||
|
}
|
||||||
|
|
||||||
|
status()
|
||||||
|
{
|
||||||
|
local func=ssd_status
|
||||||
|
case "$supervisor" in
|
||||||
|
?*)
|
||||||
|
ewarn "Invalid supervisor, \"$supervisor\", using start-stop-daemon"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
$func
|
||||||
|
}
|
||||||
|
|
||||||
yesno $RC_DEBUG && set -x
|
yesno $RC_DEBUG && set -x
|
||||||
|
|
||||||
_conf_d=${RC_SERVICE%/*}/../conf.d
|
_conf_d=${RC_SERVICE%/*}/../conf.d
|
||||||
@ -146,14 +182,8 @@ unset _conf_d
|
|||||||
# Load any system overrides
|
# Load any system overrides
|
||||||
sourcex -e "@SYSCONFDIR@/rc.conf"
|
sourcex -e "@SYSCONFDIR@/rc.conf"
|
||||||
|
|
||||||
# load a service supervisor
|
# load service supervisor functions
|
||||||
sourcex "@LIBEXECDIR@/sh/start-stop-daemon.sh"
|
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
|
# Set verbose mode
|
||||||
if yesno "${rc_verbose:-$RC_VERBOSE}"; then
|
if yesno "${rc_verbose:-$RC_VERBOSE}"; then
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# Default start / stop / status functions
|
# start / stop / status functions for start-stop-daemon
|
||||||
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
||||||
# Released under the 2-clause BSD license.
|
# Released under the 2-clause BSD license.
|
||||||
|
|
||||||
start()
|
ssd_start()
|
||||||
{
|
{
|
||||||
[ -n "$command" ] || return 0
|
[ -n "$command" ] || return 0
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ start()
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
stop()
|
ssd_stop()
|
||||||
{
|
{
|
||||||
local startcommand="$(service_get_value "command")"
|
local startcommand="$(service_get_value "command")"
|
||||||
local startpidfile="$(service_get_value "pidfile")"
|
local startpidfile="$(service_get_value "pidfile")"
|
||||||
@ -65,7 +65,7 @@ stop()
|
|||||||
eend $? "Failed to stop $RC_SVCNAME"
|
eend $? "Failed to stop $RC_SVCNAME"
|
||||||
}
|
}
|
||||||
|
|
||||||
status()
|
ssd_status()
|
||||||
{
|
{
|
||||||
_status
|
_status
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user