As Andres suggested, you could guard the curl call in the check script with
a condition for a pidfile existing.

For the specific case you asked about (doing a migration), you can stop the
check using supervisorctl before you stop the server process:
supervisortctl stop mycheck
supervisorctl stop myserver
# perform maintenance
supervisorctl start myserver
supervisorcts start mycheck

On Fri, Feb 6, 2015 at 3:51 PM, Andres Reyes Monge <[email protected]>
wrote:

> I would have process create a pidfile on start and delete it on exit.
>
> That way if the process doesn't exit successfully the pidfile will be
> there but the curl test will fail
>
> Regards
>
> On Fri Feb 06 2015 at 3:48:19 PM Mikko Ohtamaa <[email protected]>
> wrote:
>
>> Hi,
>>
>>
>> If you're going to have a single server process command and a single
>>> check, then you could just have supervisor keep both running and use a
>>> shell script for the check. Something like this:
>>>
>>>
>>>
>> Thanks for the answer! One more question - what would be the correct way
>> to check if the process myserver has been intentionally stopped (e.g. it is
>> not in running state according to supervisorctl) - as this functionality is
>> what httpok module provides also. It does not try to restart processes
>> which have been taken down intentionally (e.g. for the duration of
>> migration). Or does the config already do it somehow - and I don't manage
>> to spot it?
>>
>> while 1; do
>> if curl -f -X POST --connect-timeout=1 -m 1 -d 'post body'
>> http://localhost/check
>> then
>>     sleep 60
>> else
>>     supervisorctl restart myserver
>>     sleep 60
>> fi
>>
>>
>>
>> ...
>>  _______________________________________________
>> Supervisor-users mailing list
>> [email protected]
>> https://lists.supervisord.org/mailman/listinfo/supervisor-users
>>
>
> _______________________________________________
> Supervisor-users mailing list
> [email protected]
> https://lists.supervisord.org/mailman/listinfo/supervisor-users
>
>

-- 

This e-mail, including attachments, contains confidential and/or 
proprietary information, and may be used only by the person or entity to 
which it is addressed. The reader is hereby notified that any 
dissemination, distribution or copying of this e-mail is prohibited. If you 
have received this e-mail in error, please notify the sender by replying to 
this message and delete this e-mail immediately.
_______________________________________________
Supervisor-users mailing list
[email protected]
https://lists.supervisord.org/mailman/listinfo/supervisor-users

Reply via email to