How to add a entry in inittab?


 
Thread Tools Search this Thread
Operating Systems Linux How to add a entry in inittab?
# 1  
Old 04-24-2012
MySQL How to add a entry in inittab?

Hi All,

I am booting by Linux box with the run level 3 and it gets booted successfully.

I want to execute a script once the system is up and running in the run level 3. I was trying to add a entry to /etc/inittab to execute my script once the system is up.
I have added the below ennty to the /etc/inittab. But it does not execute the script the script when the box came up.

Code:
1:3:once://opt/myscript

Thanks,
Kalai

Last edited by kalpeer; 04-24-2012 at 07:10 AM.. Reason: code tags
# 2  
Old 04-24-2012
did you follow that on the console?
and you can change the id for to execute that without duplicate id(1) warning.
try to add after the "initdefault" line..
Code:
sh:3:once:/opt/myscript

# 3  
Old 04-24-2012
Why do you want to add the entry to /etc/inittab? The more usual approach (assuming a SysV rc) is to add the script into /etc/init.d and then symbolically link to this script from /etc/rc3.d/SXXscript and/or /etc/rc3.d/KXXscript.
# 4  
Old 04-26-2012
Quote:
Originally Posted by ygemici
did you follow that on the console?
and you can change the id for to execute that without duplicate id(1) warning.
try to add after the "initdefault" line..
Code:
sh:3:once:/opt/myscript

Thanks a lot.

If I add this condition after the id:3:initdefault: , will it be executed after all the required service is started for the run level 3.

---------- Post updated at 10:32 PM ---------- Previous update was at 10:30 PM ----------

Quote:
Originally Posted by fpmurphy
Why do you want to add the entry to /etc/inittab? The more usual approach (assuming a SysV rc) is to add the script into /etc/init.d and then symbolically link to this script from /etc/rc3.d/SXXscript and/or /etc/rc3.d/KXXscript.
I want to execute my script, once the system is up and running in Level 3. My script needs to be executed only after all the required service is up and running for Level 3.
Due to this planed to add it in inittab. Please correct me if my understanding is wrong.
# 5  
Old 04-26-2012
Kal,

This is going against the entire purpose of what init does. You should stop trying to kludge together a solution and use the appropriate tools for the job.

Sure, you can drive screws into walls with a brick, but you end up with lackluster, and unsupportable structures.

Write an init script and put it into the appropriate rc directory. chkconfig it on.
# 6  
Old 04-26-2012
Quote:
Due to this planed to add it in inittab. Please correct me if my understanding is wrong.
Your understanding is wrong. The inittab line you posted would be executed immediately run state 3 started (if it was typed correctly).

There should be a line in inittab already which runs the rc process and it is this process which starts or stops all processes on entry or exit from a run state. See man rc and the comments from other posters above.

Last edited by methyl; 04-26-2012 at 11:21 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed command to add a new column entry

My input file looks like this 12 3 5.122.281.413 172.31.15.220 3421 4133 2 2 1454 3421 4133 2 2 0 12 44036 214.215.52.146 90.123.245.211 2312 3911 4 4 521 2312 3911 4 4 1 14 504 6.254.324.219 192.61.27.120 4444 5611 7 5 1415 4444 5611 7 5 1 ... (2 Replies)
Discussion started by: sampitosh
2 Replies

2. How to Post in the The UNIX and Linux Forums

Help me, write a bash script to delete parent entry with all their child entry in LDAP UNIX server

Hi All, Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries. example: Parent is : ---------- dn: email=yogesh.kumar@wipro.com, o=wipro, o=in child is: ---------- dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies

3. UNIX for Dummies Questions & Answers

awk to add/subtract an integer to/from each entry in columns?

---------- Post updated at 01:58 PM ---------- Previous update was at 01:48 PM ---------- For some reason my question is not getting printed. Here are the details: Greetings. I would like to add/subtact an integer to/from two columns of integers. I feel like this should be easy using awk... (3 Replies)
Discussion started by: Twinklefingers
3 Replies

4. Shell Programming and Scripting

unique entry add values

Hi, I have a file with 3 columns ABC 3 1 ABC 5 1 XYZ 4 2 DEF 3 2 DEF 4 1 DEF 6 1 MNO 5 5 JKL 3 2 JKL 4 2 PQR 12 1 For each unique entry in column 1 I want to add values in column 2 and column3 o/p ABC 8 2 XYZ 4 2 (1 Reply)
Discussion started by: Diya123
1 Replies

5. Linux

How to add entry into .bash_profile file

Hi, Currently If i have created new userID then .bash_profile file is created under the new user. Now, I would like to add one path in this file. Please help on this . Current file output: # .bash_profile # Get the aliases and functions if ; then . ~/.bashrc fi #... (4 Replies)
Discussion started by: Mani_apr08
4 Replies

6. Shell Programming and Scripting

How to add each entry in an unix file?

Hi, I've a data file having entries like this- $ cat BDWL.out 19571 349484 18963 349568 20180 351389 20372 350253 Now I want to add each entry and produce the final sum =1479780 as output. How can I do that using unix shell scripting?? using loop or sed/awk ?? Thanks, Naresh (5 Replies)
Discussion started by: NARESH1302
5 Replies

7. Red Hat

Adding or deleting an entry in /etc/inittab without using vi editrors or any editor.

Hi masters Is there any way to edit or delete an entry in inittab file without using vi or any editors? We can use commands instead or any shell script .. If any one can help deeply appreciated Thanks a lot sai (3 Replies)
Discussion started by: saidiya
3 Replies

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

9. AIX

How to add DNS entry in AIX 5.3

we have using windows 2003 server as DNS Server, now we want add dns entry in AIX 5.3 server. can any body help (1 Reply)
Discussion started by: Balajipoola007
1 Replies

10. AIX

How to add an entry in the errpt

Hi, I'm looking for a tool or a command to generate entries in the AIX error log (errpt). I know the command errlogger but I need to simulate HARDWARE or TEMP entries for test purpose. Anyone knows something that can help me ? Thanks (1 Reply)
Discussion started by: fwirbel
1 Replies
Login or Register to Ask a Question