mkitab problem with /etc/inittab respawning


 
Thread Tools Search this Thread
Operating Systems AIX mkitab problem with /etc/inittab respawning
# 1  
Old 07-21-2008
mkitab problem with /etc/inittab respawning

Hi All,

May be a dumb question to old AIX hacks, if so apologize.
I have worked with /etc/inittab on SCO, but apparently with AIX you should use the 'mkitab' command to add entries instead of just vi'ing the file.

I just need a daemon process (script called 'dpr_daemon') to kick off once and restart if it is ever killed.
After checking through documentation, the logical step appears to be (level 2, normal) add to inittab w/this line:


mkitab "dprdaemon:2:respawn:/dplogs/dpr_daemon"

However, when I do this, I immediately find 10-25 dpr_daemons running on the box. The shock and awe result. Live box, can't play around too much with this.

Is there something I am missing? Surely 'respawn' is as documented in man pages, respawn the process only if killed. 'once' would not restart the process if killed.

Thanks much for any advice---
jpass
# 2  
Old 07-22-2008
The syntax is correct, but it seems init thinks that process is already dead and spawns a new one. If I find anything about it, I will post it.
# 3  
Old 07-22-2008
Someone mentioned that perhaps since this program runs in the background, that inittab thinks the program has ended and keeps respawning again and again.

But I don't know how to write a daemon that runs in the foreground. Is there such a thing? Then it would become a program, and no longer be a daemon anymore.
Not sure, dont' completely understand.

Last edited by jeffpas; 07-22-2008 at 04:07 PM..
# 4  
Old 07-23-2008
I think the thing you need to ask is does the script run continuously or does it naturally finish (die). If it does in fact finish then it will respawn. What does the script do?
# 5  
Old 07-26-2008
Quote:
Originally Posted by jeffpas
[...] I just need a daemon process (script called 'dpr_daemon') to kick off once and restart if it is ever killed.
After checking through documentation, the logical step appears to be (level 2, normal) add to inittab w/this line:


mkitab "dprdaemon:2:respawn:/dplogs/dpr_daemon"

However, when I do this, I immediately find 10-25 dpr_daemons running on the box. [...]
I don't know SCO. As an AIX admin I'd probably create a subsystem and put it under control of the AIX System Resource Controler SRC. Start with the mkssys man page if that was an option.
However, if you want to stick to your setup - what if your script would check itself whether it is already running so that it would refrain from starting again while it is active?
# 6  
Old 09-22-2008
I would have to assume then that the command for doing this (in my instance) would be:

mkssys -p /dplogs/dpr_daemon -s dprdaemon -u 0 -a "-D" -e /dev/null -i /dev/null -o /dev/null -R -S -f 9 -n 15

you would then:

startsrc -s dprdaemon
stopsrc -s dprdaemon

To start and stop the process, and it would automatically restart if killed.

I have seen examples with a "-G tcpip" tacked on the end, but since this new little daemon is I assume not related to any group, I would think that would not be included.

I don't completely understand the references to /dev/null here but does anyone see any holes here? I assume this would make it permanent? I really don't have the option of shutting down/rebooting the box.
Just looking for help, thanks!

jeffpas
# 7  
Old 09-22-2008
Quote:
Originally Posted by jeffpas
Someone mentioned that perhaps since this program runs in the background, that inittab thinks the program has ended and keeps respawning again and again.

But I don't know how to write a daemon that runs in the foreground. Is there such a thing? Then it would become a program, and no longer be a daemon anymore.
Not sure, dont' completely understand.
When a daemon (such as init) runs a subprocess, it is also a daemon. No need to do anything else.

Let's say that init spawns process 1234 for your program. Now init expects pid 1234 to stay around. If it exits, init will respawn it. This is why your program must not try to redaemonize itself. That involves spawning a child and then exiting. init will not recognize the child of pid 1234 as a replacement. Pid 1234 died, so init thinks it needs another copy.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script calling by inittab

Hi to all , i wrote a small script and i add it to inittab to start the script during Startup. The script works fine , if i call it from the prompt but if it is call from inittab it is runnng too but it does not recognize system variable like USER , LOGNAME. Since i running out of ideas i... (12 Replies)
Discussion started by: Nadielosabra
12 Replies

2. UNIX for Dummies Questions & Answers

Inittab configuration

I am installing BusyBox on a device that does not have keyboard or serial connection, so I log into the system with SSH. I am in doubt about what to put in the inittab file. This is the content of the file: ::sysinit:/etc/init.d/rcS ::respawn:/bin/login ::shutdown:/sbin/swapoff -a... (1 Reply)
Discussion started by: richard78
1 Replies

3. AIX

problem to restart services from /etc/inittab in AIX6.1

hello, i have an AIX6.1.7.2 machine that it was upgraded recently from AIX5.3.9.4. when i kill system services that should restart automatically like /usr/sbin/cron it doesnt start. i checked my /etc/inittab file and i confirmed that this service is in respawn status so when i kill this process... (2 Replies)
Discussion started by: omonoiatis9
2 Replies

4. UNIX for Dummies Questions & Answers

What breaks inittab

Today there was a situation where processes running from inittab was broken. Can someone help me understand, how to find out, who might have stopped those processes? Or how does it get broken? G (2 Replies)
Discussion started by: ggayathri
2 Replies

5. Solaris

inittab entry does not works

Hi, I have a solaris 10 server,which has a process running that communicates with other system.I have made following entry in the inittab file. PM15:s12345:respawn:/ncm/bin/communicator PM15 : Unique process ID s12345 : run levels respawn : if anytime the process... (2 Replies)
Discussion started by: asalman.qazi
2 Replies

6. Solaris

inittab in Solaris 10

Hi, In Solaris 9 and below release we are using the rc script in inittab. I don't have much idea abt inittab in Solaris. In Solris 9 and below: We use rc3 script to start up the server. And we run database script before the rc3. os:23:respawn:/etc/init.d/database start >/dev/null 2>&1... (7 Replies)
Discussion started by: kalpeer
7 Replies

7. HP-UX

INIT: Command respawning too rapidly

INIT:Command is respawning too rapidly Check for errors: id:cons /usr/sbin/getty console console A solution I read about in a different HPUX Forums help pages on line, said to add the -h option to this command in the /etc/inittab file to correct the problem. I tried this and it did not... (2 Replies)
Discussion started by: 1bigdog
2 Replies

8. UNIX for Dummies Questions & Answers

HP-UX respawning boot failure

Hello. System is a HP Visualize C3600 running X11 and after a power failure machine will not boot (see error messages below) From what I've read, this may be caused by a corrupted etc/inittab file. Solution suggested on other websites is to boot in single user mode and edit file inittab... (2 Replies)
Discussion started by: westcoast
2 Replies

9. UNIX for Dummies Questions & Answers

Command is respawning too rapidly..message

Ran into a new one today at work...... I was told to start 2 servers which were shut down due to a power outage(I don't believe they were shut down incorrectly). After fsck, both console logins appear with the message: INIT: Command is respawning too rapidly. Check for possible errors. >... (5 Replies)
Discussion started by: finster
5 Replies

10. UNIX for Dummies Questions & Answers

inittab solaris

Hi! Is it possible to add more ttys in Solaris, like with inittab in Linux? I want to switch between the ttys with Alt F1+F2+F3 .... like Linux does. How can i do this? (1 Reply)
Discussion started by: donald1111
1 Replies
Login or Register to Ask a Question