[CentOS] Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?

Thu Oct 6 09:55:03 UTC 2011
Michael Gliwinski <Michael.Gliwinski at henderson-group.com>

On Wednesday 05 Oct 2011 18:04:08 Alexander Farber wrote:
> My script has 2 pecularities:
> 
> 1) When it gets SIGTERM or SIGINT, it writes some data into PostgreSQL
> and this takes 10-15 seconds
> 
> 2) When it is started numerous times,
> then the subsequent runs
> will fail immediately, because only the 1st instance
> will be able to listen at the TCP-port 8080
> 
> And in /var/log/messages I see:
> 
> ...
> 17:44:25 static init: pref main process ended, respawning
> 17:44:26 static init: pref main process (2128) terminated with status 98
> 17:44:26 static init: pref main process ended, respawning
> 17:44:26 static init: pref main process (2133) terminated with status 98
> 17:44:26 static init: pref respawning too fast, stopped
> 
> is that all maybe the reason and is there something I could do?
> (maybe somehow delay the subsequent spawns?)

To solve this problem you can add 'kill timeout 30' to pref.conf, this 
basically tells upstart that a process may take up to 30 seconds to exit after 
SIGTERM, and only if it doesn't exit after that it will send SIGKILL.

But as for the issue of why upstart is not picking up the PID correctly, I'm 
not sure yet.  I'm actually dealing with similar issue now so I'll post more 
when I find something.

BTW, just noticed you're using su -c to run the program.  I think this spawns 
a shell which may be the cause.  Could you add 'expect fork' to pref.conf and 
see if it changes anything?


-- 
Michael Gliwinski
Henderson Group Information Services
9-11 Hightown Avenue, Newtownabby, BT36 4RT
Phone: 028 9034 3319

**********************************************************************************************
The information in this email is confidential and may be legally privileged.  It is intended solely for the addressee and access to the email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed  in the governing client engagement leter or contract.
If you have received this email in error please notify support at henderson-group.com

John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*********************************************************************************