1833776 Members
2439 Online
110063 Solutions
New Discussion

inittab entries

 
SOLVED
Go to solution
David DiBiase
Frequent Advisor

inittab entries

I have a program running from inittab without incident.
ent7:3:respawn:/path_to_cmds/c_pgm

I now need to 'dot' in different environments on different systems. Is the following allowed / proper??

ent7:3:respawn:{ . /env_vars ; /path_to_cmds/c_pgm }
5 REPLIES 5
Sundar_7
Honored Contributor
Solution

Re: inittab entries

I haven't tried anything like that before and cannot comment if it is going to work or not.

But, I can suggest the safest way to implement this is to create a wrapper with these two lines and call them from /etc/inittab.
Learn What to do ,How to do and more importantly When to do ?
David DiBiase
Frequent Advisor

Re: inittab entries

I tried that but when the shell wrapper exited, (I think) init saw the wrapper die and respawned another one as so on ....
Patrick Wallek
Honored Contributor

Re: inittab entries

I think you would be better off wrapping the whole thing in a single script and then using that script in inittab.

# cat /path_to_cmds/a_script
#!/usr/bin/sh
. /env_vars
/patch_to_cmds/c_pgm

Then your inittab line:

ent7:3:respawn:/path_to_cmds/a_script
Sundar_7
Honored Contributor

Re: inittab entries

I dont know if this will work, but you can give it a try

# vi /path_to_cmds/wrapper
. /env_vars
exec /path_to_cmds/c_pgm
#
Learn What to do ,How to do and more importantly When to do ?
David DiBiase
Frequent Advisor

Re: inittab entries

Thanks all for your ideas. Because I don't like to leave shells around that can be changed, I went with:
/sbin/sh -c "lots of stuff"
in the inittab entry