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

Wed Oct 5 15:51:43 UTC 2011
Alexander Farber <alexander.farber at gmail.com>

Hello Michael and others -

On Wed, Oct 5, 2011 at 5:42 PM, Michael Gliwinski
<Michael.Gliwinski at henderson-group.com> wrote:
> On Wednesday 05 Oct 2011 15:03:43 Alexander Farber wrote:
>>
>> start on stopped rc RUNLEVEL=3
>> stop on starting rc RUNLEVEL=[!3]
>> console output
>> respawn
>> chdir /tmp
>> exec /bin/su -c '/usr/local/pref/pref.pl >/tmp/pref-`date +%a`.txt 2>&1'
>> afarber
>>
>> # sudo initctl stop pref
>> initctl: Unknown instance:
>
> Does your pref.pl fork or daemonize itself?  You may need to add 'expect fork'
> or 'expect daemon' to your pref.conf.  Is the PID you get from `status pref'
> the same as you see in ps output?

No, it doesn't daemoniz or fork anything and
prints stuff to stdout and stderr only -
because I was running it with /etc/inittab
on the CentOS 5.7 (and thus shouldn't daemonize).

The pid doesn't match or I can't get it:

(I've omitted "sudo " below, I use CLI as "afarber"):

# initctl status pref
pref start/running, process 1507
# initctl restart pref
pref start/running, process 2083
# initctl restart pref
initctl: Unknown instance:
# initctl restart pref
initctl: Unknown instance:

# ps uwx
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
afarber   1532  0.0  0.0 108788 15084 ?        S    16:05   0:00
/usr/bin/perl -w /usr/local/pref/pref.pl

#  netstat -an | grep -w 8080
tcp        0      0 0.0.0.0:8080                0.0.0.0:*
     LISTEN

# initctl status pref
pref stop/waiting

Any ideas please?

I've also added more details at
http://serverfault.com/questions/318742/etc-inittab-respawn-script-migrating-from-rhel-centos-5-x-to-6-x

Thank you
Alex