Re: runit proper shutdown

From: Joe M <joe9mail_at_gmail.com>
Date: Wed, 23 Oct 2013 15:06:37 -0500

Hello Charlie,

Thanks for responding.

>> Following the advice the below articles:
>>
>> http://mywiki.wooledge.org/ProcessManagement#I.27m_trying_to_kill_-9_my_job_but_blah_blah_blah...
>
> Except you aren't apparently following this piece of advice:
>
> If the process is ignoring normal SIGTERMs, then get the source code
> and fix it!

That is a good point.

I am trying to see if anyone has any code snippets to replicate the
above behaviour. I presume that I would have to send SIGTERM and then
have a for loop for any running services and then send the SIGINT,
etc.

>> http://partmaps.org/era/unix/award.html#uuk9letter
>>
>> I am trying to figure out how to implement "Generally, send 15 (TERM),
>> and wait a second or two, and if that doesn't work, send 2 (INT), and
>> if that doesn't work, send 1 (HUP)."
>>
>> I tried to do this in "3":
>>
>> sync && sync && sync
>>
>> echo 'Waiting for services to stop...'
>> # send 15 (TERM), wait a second or two
>> sv -w5 term /run/runit/runsvdir/current/*
>>
>> # if that doesn't work, send 2 (INT)
>> sv -w5 interrupt /run/runit/runsvdir/current/*
>>
>> # if that doesn't work, send 1 (HUP)
>> sv -w5 hup /run/runit/runsvdir/current/*
>> sleep 5
>>
>> # below shutdown sends TERM and CONT to running services
>> sv -w30 shutdown /run/runit/runsvdir/current/*
>>
>> But, when I send the INT, sv seems to be starting the process instead.
>
> Presumably the supervised process has exited, as you wanted it to do, and
> runsv is starting a new instance, as it is expected to.
>
> If you want runsv not to start a new instance, you have to use 'down' or
> 'stop' as args to 'sv'.

I prefer shutdown to down/stop. But, I just wanted to see if I could
do the above with sv.

Thanks
Joe
Received on Wed Oct 23 2013 - 20:06:37 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:18 UTC