FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 10-05-2011, 05:04 PM
Alexander Farber
 
Default Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?

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?)

Regards
Alex

On Wed, Oct 5, 2011 at 5:51 PM, Alexander Farber
<alexander.farber@gmail.com> wrote:
> http://serverfault.com/questions/318742/etc-inittab-respawn-script-migrating-from-rhel-centos-5-x-to-6-x
>
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-05-2011, 05:04 PM
Alexander Farber
 
Default Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?

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?)

Regards
Alex

On Wed, Oct 5, 2011 at 5:51 PM, Alexander Farber
<alexander.farber@gmail.com> wrote:
> http://serverfault.com/questions/318742/etc-inittab-respawn-script-migrating-from-rhel-centos-5-x-to-6-x
>
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-05-2011, 05:22 PM
Les Mikesell
 
Default Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?

On Wed, Oct 5, 2011 at 12:04 PM, Alexander Farber
<alexander.farber@gmail.com> 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?)

Can you make it sleep a bit and retry the socket open a few times if
it fails due to the previous process not releasing the port yet?

--
Les Mikesell
lesmikesell@gmail.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-05-2011, 05:22 PM
Les Mikesell
 
Default Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?

On Wed, Oct 5, 2011 at 12:04 PM, Alexander Farber
<alexander.farber@gmail.com> 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?)

Can you make it sleep a bit and retry the socket open a few times if
it fails due to the previous process not releasing the port yet?

--
Les Mikesell
lesmikesell@gmail.com
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-05-2011, 05:30 PM
Alexander Farber
 
Default Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?

Good idea, thank you!

On Wed, Oct 5, 2011 at 7:22 PM, Les Mikesell <lesmikesell@gmail.com> wrote:
> Can you make it sleep a bit and retry the socket open a few times if
> it fails due to the previous process not releasing the port yet?
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-05-2011, 05:30 PM
Alexander Farber
 
Default Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?

Good idea, thank you!

On Wed, Oct 5, 2011 at 7:22 PM, Les Mikesell <lesmikesell@gmail.com> wrote:
> Can you make it sleep a bit and retry the socket open a few times if
> it fails due to the previous process not releasing the port yet?
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-05-2011, 05:34 PM
 
Default Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?

Les Mikesell wrote:
> On Wed, Oct 5, 2011 at 12:04 PM, Alexander Farber
> <alexander.farber@gmail.com> 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
<snip>
Ok, here's an option: change it to perl, and make it a multithreaded
process, so that it can wait at the critical point.

fork
do stuff that doesn't need the port
if child,
exit
if parent
if #0 ended,
fork #2
else loop

mark




_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-05-2011, 05:34 PM
 
Default Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?

Les Mikesell wrote:
> On Wed, Oct 5, 2011 at 12:04 PM, Alexander Farber
> <alexander.farber@gmail.com> 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
<snip>
Ok, here's an option: change it to perl, and make it a multithreaded
process, so that it can wait at the critical point.

fork
do stuff that doesn't need the port
if child,
exit
if parent
if #0 ended,
fork #2
else loop

mark




_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-06-2011, 09:55 AM
Michael Gliwinski
 
Default Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?

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@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
************************************************** *******************************

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 10:08 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org