1836603 Members
2341 Online
110102 Solutions
New Discussion

/etc/inittab entries.

 
SOLVED
Go to solution
aruns_s
Frequent Advisor

/etc/inittab entries.

Hi,
I hv added a new entry to /etc/inittab.
-------------------------------------------
eigsec1:23456:respawn:/usr/bin/su - eigsec "-c /usr/bin/ssh -nNTx -o ServerAliveInterval=60 -L 9883:auyxuap003wbcx2.unix.srv.w
estpac.com.au:1521 auyxuap003wbcx2.unix.srv.westpac.com.au >/dev/null 2>&1"
----------------------------------------------
Would this process start automatically?Or would it come to affect only after a system reboot..
9 REPLIES 9
Hasan  Atasoy
Honored Contributor

Re: /etc/inittab entries.

hi arun ;

inetd -c

Hasan
aruns_s
Frequent Advisor

Re: /etc/inittab entries.

Thanks Hasan,

Is the above syntax correct? it is giving me following error,
INIT: Command is respawning too rapidly.
Will try again in 5 minutes.
Check for possible errors.

Deepak Kulkarni
Regular Advisor
Solution

Re: /etc/inittab entries.

Hi Arun,

You need to run init -q for that.

Rgds
DK
Deepak Kulkarni
Regular Advisor

Re: /etc/inittab entries.

Hi Arun,

You need to run "init -q" to make active new entries.

Rgds
DK
Deepak Kulkarni
Regular Advisor

Re: /etc/inittab entries.

Sorry for double posting.......neetwork connection problem...
aruns_s
Frequent Advisor

Re: /etc/inittab entries.

hi Deepak,

I did run an init -q , but still coming up with same errors. I doubt, my syntax is wrong
Matti_Kurkela
Honored Contributor

Re: /etc/inittab entries.

The message "INIT: Command is respawning too rapidly. Will try again in 5 minutes." means that the init process has started your command, but the command has exited almost immediately, so init had to restart it. This cycle has repeated a few times, so init concludes further restart attempts are not likely to be helpful just now. It stops trying for 5 minutes, to prevent a configuration mistake from consuming all the available CPU time.

You have redirected the error messages of your command to /dev/null, so there is no information about what is wrong.

Change the ">/dev/null 2>&1" part of the command to ">>/tmp/port_forward.log 2>&1" or something similar.

Then execute "init -q" to make init try again a few times, then read the file (/tmp/port_forward.log or whatever name you used).

As a matter of personal preference: I would not embed a complex command like that directly to /etc/inittab.
I would make it a small two-line script (the first line would be "#!/bin/sh", the second your command). After making the script executable and testing that it works, I might add an inittab entry to _execute that script_.

A wild guess about the cause of the error:
maybe the su command is returning an error because of strange quoting?

You have:
...su - eigsec "-c /usr/bin/ssh ...

Try this instead:

...su - eigsec -c "/usr/bin/ssh ...

MK
MK
aruns_s
Frequent Advisor

Re: /etc/inittab entries.

Thanks to all.
Finally, the process has started.But I could see two process in ps -ef output,I think one is the shell process. Is there a way we can aviod these shell process? Thank you

eigsec 13180 13109 0 11:53:06 ? 0:00 /usr/bin/ssh -nNTx -o ServerAliveInterval=60 -L 9884:auaeuap009
eigsec 13109 1 0 11:53:06 ? 0:00 -ksh -c /usr/bin/ssh -nNTx -o ServerAliveInterval=60 -L 9884:au
Dennis Handly
Acclaimed Contributor

Re: /etc/inittab entries.

>Is there a way we can avoid these shell process?

As the last line of your shell script you should use:
eval /usr/bin/ssh ...

If you still have that "su ... -c" in inittab, you might be able to insert that eval there, before the /usr/bin/ssh.

Warning: Don't use eval if you have here documents in your script.