introduced the environment variable WAIT_INTERVAL for the grace period in the stop method

This commit is contained in:
Tamás Gérczei 2016-04-30 07:26:41 +02:00
vanhempi 8f9e0ef6ae
commit 0b8bbd8ed9
3 muutettua tiedostoa jossa 3 lisäystä ja 2 poistoa

Näytä tiedosto

@ -10,6 +10,6 @@ This will tag all VMs with the priority of 0 which will leave them <strong>stopp
...and so on. Informational messages are logged via the syslog facility as '<i>daemon.notice</i>' entries tracking the determined order as well as the outcome for every step taken. The solution comprises two services backed by the same single method script: one activated before <i>svc:/system/zones</i> in order to convince it not to start any guests and the actual payload starting once vmadmd is available to evaluate the tags and complete the sequence.
SMF will import the manifests for the services upon boot-up when it initializes its repository. The location of the method script is configurable via the service property <i>config/method_prefix</i>, defaulting to <strong><i>/opt/custom/bin</i></strong>. The start-up delay defaults to <strong><i>30</i></strong> seconds, also configurable via the context environment variable <i>DELAY</i> for the method <i>start</i>. A grace period of <strong>5</strong> minutes is granted for shut-down, configurable via the context environment variable <i>GRACE_PERIOD</i> in the <i>stop</i> method.
SMF will import the manifests for the services upon boot-up when it initializes its repository. The location of the method script is configurable via the service property <i>config/method_prefix</i>, defaulting to <strong><i>/opt/custom/bin</i></strong>. The start-up delay defaults to <strong><i>30</i></strong> seconds, also configurable via the context environment variable <i>DELAY</i> for the method <i>start</i>. A grace period of <strong>5</strong> minutes is granted for shut-down, configurable via the context environment variables <i>GRACE_PERIOD</i> and <i>WAIT_INTERVAL</i> in the <i>stop</i> method.
In the future the method script might get re-written in node.js in order to make a more human-friendly dependency notation/handling possible. This is merely the shortest path.

Näytä tiedosto

@ -18,6 +18,7 @@
<method_context>
<method_environment>
<envvar name='GRACE_PERIOD' value='300'/>
<envvar name='WAIT_INTERVAL' value='10'/>
</method_environment>
</method_context>
</exec_method>

Näytä tiedosto

@ -65,7 +65,7 @@ case $1 in
do
if [ $(date +%s) -le $WAIT_UNTIL ];
then
sleep 1
sleep ${WAIT_INTERVAL:-10}
else
exit $SMF_EXIT_ERR_FATAL
fi