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

Wed Oct 5 17:34:32 UTC 2011
m.roth at 5-cent.us <m.roth at 5-cent.us>

Les Mikesell wrote:
> On Wed, Oct 5, 2011 at 12:04 PM, Alexander Farber
> <alexander.farber at 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