Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   CentOS (http://www.linux-archive.org/centos/)
-   -   Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts? (http://www.linux-archive.org/centos/583620-migrating-centos-5-6-where-put-etc-inittab-respawn-scripts.html)

Brian Mathis 10-04-2011 09:51 PM

Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?
 
On Tue, Oct 4, 2011 at 5:44 PM, Alexander Farber
<alexander.farber@gmail.com> wrote:
> Hello,
>
> sorry, for 1 more question on CentOS 5 -> CentOS 6 migration.
>
> On my old CentOS 5.7 machine I have the following line:
>
> pref:3:respawn:/bin/su -c '/usr/local/pref/pref.pl >/tmp/pref-`date
> +%a`.txt 2>&1' afarber
>
> and this has served me well, I don't want to install
> anything else like daemontools etc. - to keep my web-server
> easily reinstallable (or movable to another hoster).
>
> But now I have migrated to CentOS 6.0, added that line
> and the "init q", but nothing happens - as indeed promised
> by the comments in the new /etc/inittab.
>
> Where should I move my line, which docs to read?
>
> The pref.pl is a poll()ing TCP-sockets daemon for a game
>
> Thank you
> Alex


This sounds like something you should be using the 'service' framework
for, instead of inittab. In CentOS 5 you would create a script in
/etc/init.d and start the service from there. I'm not yet familiar
with CentOS 6, but I would bet looking for docs on how to do that will
lead you in the right direction.


-☙ Brian Mathis ❧-
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Johnny Tan 10-05-2011 03:46 AM

Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?
 
On Oct 4, 2011 5:45 PM, "Alexander Farber" <alexander.farber@gmail.com>
wrote:
>
> Where should I move my line, which docs to read?

Like recent Ubuntus, C6 uses upstart in place of traditional Sys V init.

Likely, you will want this in /etc/init/ -- note!, not the same as
/etc/init.d/

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

R P Herrold 10-05-2011 05:54 AM

Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?
 
On Tue, 4 Oct 2011, Johnny Tan wrote:

> Like recent Ubuntus, C6 uses upstart in place of traditional Sys V init.
>
> Likely, you will want this in /etc/init/ -- note!, not the same as
> /etc/init.d/

I don't know WHAT you are looking at, if anything, but it is
not a CentOS 6 install; 'upstart' is a non-starter for the
future, and certainly not in CentOS' upstream's plans

[root@centos6-32 ~]# rpm -qa sys*
sysvinit-tools-2.87-3.dsf.el6.i686
system-config-firewall-base-1.2.27-3.el6_0.2.noarch
[root@centos6-32 ~]# cd /etc/init.d/
[root@centos6-32 init.d]# ls
atd crond iptables netfs rsyslog single udev-post
auditd functions killall network sandbox snmpd
cgconfig halt named rdisc saslauthd snmptrapd
cgred ip6tables netconsole restorecond sendmail sshd
[root@centos6-32 init.d]# ls -al ../rc*
-rwxr-xr-x. 1 root root 2617 Jun 25 00:07 ../rc
-rwxr-xr-x. 1 root root 220 Jun 25 00:07 ../rc.local
-rwxr-xr-x. 1 root root 19088 Jun 25 00:07 ../rc.sysinit

../rc0.d:
total 8
drwxr-xr-x. 2 root root 4096 Oct 3 12:27 .
drwxr-xr-x. 10 root root 4096 Aug 18 07:03 ..
lrwxrwxrwx. 1 root root 13 Oct 3 12:02 K05atd -> ../init.d/atd
lrwxrwxrwx. 1 root root 19 Oct 3 12:02 K10saslauthd -> ../init.d/saslauthd
lrwxrwxrwx. 1 root root 14 Oct 3 12:02 K25sshd -> ../init.d/sshd
lrwxrwxrwx. 1 root root 18 Oct 3 12:02 K30sendmail -> ../init.d/sendmail
lrwxrwxrwx. 1 root root 20 Oct 3 12:02 K50netconsole -> ../init.d/netconsole
lrwxrwxrwx. 1 root root 15 Oct 3 12:02 K50snmpd -> ../init.d/snmpd
...

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

Alexander Farber 10-05-2011 06:04 AM

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

unfortunately /etc/init.d doesn't seem to suit me:

I want my (sockets) script to be restarted when crashed or killed

(I kill it every night to solve memory issues with perl interpreter)

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

Michael Gliwinski 10-05-2011 09:10 AM

Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?
 
On Wednesday 05 Oct 2011 07:04:36 Alexander Farber wrote:
> unfortunately /etc/init.d doesn't seem to suit me:
>
> I want my (sockets) script to be restarted when crashed or killed

It's not /etc/init.d but /etc/init. That's what upstart is for, by default it
considers jobs to be services that need to be respawned if they exit. See
also man init(5).

Upstart provides a compatibility interface for SysV so /etc/init.d is still
there and used but this is not what you want.


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

Jim Perrin 10-05-2011 11:32 AM

Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?
 
On Wed, Oct 5, 2011 at 12:54 AM, R P Herrold <herrold@owlriver.com> wrote:

>
> I don't know WHAT you are looking at, if anything, but it is
> not a CentOS 6 install; 'upstart' is a non-starter for the
> future, and certainly not in CentOS' upstream's plans
>
>
Yeah, about that. ->
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html-single/Migration_Planning_Guide/index.html

4.2 Service Initialization ->

"In Red Hat Enterprise Linux 6, *init* from the sysvinit package has been
replaced with *Upstart*, an event-based init system. This system handles the
starting of tasks and services during boot, stopping them during shutdown
and supervising them while the system is running. For more information on
Upstart itself, refer to the init(8) man page."

Upstart is very much a non-starter. It's already been replaced in recent
fedora versions by systemd. HOWEVER, it's very much in RHEL6 and CentOS6.



While I don't think OP should necessarily be using inittab that way, there
are certainly commercial pieces of software (I'm looking at YOU Tivoli
Storage Manager!) that want to use inittab for keeping crash-prone things
alive. /etc/init is the place for this, however the format is different...
So OP is most likely going to need to rewrite things anyway.

--
During times of universal deceit, telling the truth becomes a revolutionary
act.
George Orwell
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Alexander Farber 10-05-2011 02:03 PM

Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?
 
Hello again,

I still have 1 minor problem -

I've created a new file /etc/init/pref.conf:

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

And started my script (a TCP-sockets daemon for a game) with

# sudo initctl start pref
pref start/running, process 2590

I can also see it running with "ps uawx", "netstat -an" and

# sudo initctl status pref

But I can not restart it with:

# sudo initctl restart pref
initctl: Unknown instance:

# sudo initctl stop pref
initctl: Unknown instance:

Why so? I was hoping to use the last command in a nightly
cronjob (I have to restart my script because of perl memory problems)

And also when I run

# sudo initctl start pref

several times, then I get

# sudo initctl status pref
pref
stop/waiting

- even though the process seems to run ok.

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

Michael Gliwinski 10-05-2011 03:42 PM

Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?
 
On Wednesday 05 Oct 2011 15:03:43 Alexander Farber wrote:
> I still have 1 minor problem -
>
> I've created a new file /etc/init/pref.conf:
>
> 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
>
> And started my script (a TCP-sockets daemon for a game) with
>
> # sudo initctl start pref
> pref start/running, process 2590
>
> I can also see it running with "ps uawx", "netstat -an" and
>
> # sudo initctl status pref
>
> But I can not restart it with:
>
> # sudo initctl restart pref
> initctl: Unknown instance:
>
> # 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?


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

Alexander Farber 10-05-2011 03:51 PM

Migrating CentOS 5 -> 6: where to put /etc/inittab respawn scripts?
 
Hello Michael and others -

On Wed, Oct 5, 2011 at 5:42 PM, Michael Gliwinski
<Michael.Gliwinski@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
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


All times are GMT. The time now is 05:00 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.