LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-15-2005, 02:25 PM   #1
wizhuff
LQ Newbie
 
Registered: Jul 2005
Posts: 8

Rep: Reputation: 0
/etc/inittab on Debian Linux


We are running Debian Linux to accept files via SCP. We have a Perl Daemon running which watches for the files to come in and then copies them off someplace else.

I don't fully understand how this works so I'm going to have trouble explaning it (I dind't config it) but the Perl Daemon is started via a script pointed to from the directories /etc/rc0.d - rc6.d which as I understand it is then started from our startup script /etc/inittab.

For what it's worth here is our /etc/inittab file:
=== START OF FILE
# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $

# The default runlevel.
id:2:initdefault:

# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS

# What to do in single-user mode.
~~:S:wait:/sbin/sulogin

# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.

l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin

# What to do when CTRL-ALT-DEL is pressed.
#ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
ca:12345:ctrlaltdel:echo "CTRL-ALT-DEL has been disabled"
# Action on special keypress (ALT-UpArrow).
#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."

# What to do when the power fails/returns.
pf:owerwait:/etc/init.d/powerfail start
pn:owerfailnow:/etc/init.d/powerfail now
po:owerokwait:/etc/init.d/powerfail stop

# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
# <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6

# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3
=====END OF FILE

Things work ok - except that the Perl Daemon dies every once in a while and we have to manaully restart it with a command such as:

nice -n 15 /usr/scripts/perlfile.pl

I've been trying to readup on the respawn command and want to know how I can add this to the /etc/inittab file so that the file automatically restarts when it dies....

Any help would be greatly appricated.

Thanks.
 
Old 11-16-2005, 07:51 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
inittab isn't actually relevant to what your asking. all the inittab does for you here is kicks off the relevant set of init scripts for the runlevel you're running at. Essentially it sounds like you have a homebrew service script to start a perl daemon which isn't too reliable... you'd have this script in /etc/init.d/ normally which you'd just start or stop there.. "/etc/init.d/scriptname start" rather than a command to start it directly.
 
Old 11-16-2005, 09:44 AM   #3
wizhuff
LQ Newbie
 
Registered: Jul 2005
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks for your reply.

My main question is how do I tell the script to restart when it dies??

We tried adding this to inittab:

mf::respawn:sudo userid -n perl /usr/scripts/scriptname.pl

but oddly enough this ended up creating multiple instances of the script....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rc[0-6] and inittab kpachopoulos Linux - General 1 08-12-2005 04:27 PM
Installed Debian and experiencing problems: fubarred my inittab/kdm and no internet. shodekiagari Debian 1 06-01-2005 02:09 PM
inittab mikedeatworld Linux - Software 3 08-13-2004 10:01 AM
Cant get out of inittab InEeDhElPlInUx Linux - Newbie 3 10-09-2003 02:13 PM
/etc/inittab sakeeb Linux - General 9 05-29-2002 09:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration