?
Solved

How to put a shell script in the inittab to startup everytime the server starts up

Posted on 2009-02-19
7
Medium Priority
?
2,205 Views
Last Modified: 2013-11-10
I need help/steps on how to create/enter/make an inittab for a shell script I have to startup automatically.

*I am running AIX 5.3
0
Comment
Question by:AIX25
  • 4
  • 3
7 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 23686541
Hi,
the format of an /etc/inittab entry is

identifier:runlevel:action:command

where action can be e.g. once (fire and forget), wait (fire and wait for completion), respawn (fire if not active) and off.
AIX default runlevel (multi-user & network) is 2

a typical entry could be

myjob:2:once:/path/to/my/script my para meters >/path/to/my/logfile 2>/path/to/errorlog/file

You can use vi to put the entry in /etc/inittab or you can use the 'mkitab' utility.
See man mkitab for more.
To list inittab's contents use lsitab. See man lsitab.

wmp


0
 

Author Comment

by:AIX25
ID: 23686668
Ok so if my script is called monitor-ifconfig.ksh and the path is /scripts/SA_Scripts/monitor-ifconfig.ksh.
Then it would be:
identifier???:2:respawn:/scripts/SA_Scripts/monitor-ifconfig.ksh
Is this above inittab correct?
What would be my identifier??

Thank you
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 2000 total points
ID: 23686768
The identifier is a 'label' you give to that entry. It is used by mkitab (-i flag) to find an entry point for adding new lines. (see man mkitab)
Basically, you're free to choose whatever gives you some mnemonic for your entry.

Attention: AIX init scans its inittab regularly. Should it find a 'respawn' entry whose process doesn't run, it will start it, and will only pause doing so if the process respawns too rapidly.

Take care to collect or discard the script's output (if any), else it will go to the console.

wmp

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:AIX25
ID: 23686841
so you recommend an action of 'wait'?
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 2000 total points
ID: 23686946
The normal way is using once.
A script you place in inittab should be reliable enough to start and run gracefully.
wait is meant for a configuration where the system should not continue initializing until that special script has run (and terminated).
respawn is meant for processes that are most important for the correct functioning of the whole system and should be restarted if terminated accidentally (cron and console (getty) are examples).

wmp

0
 

Author Closing Comment

by:AIX25
ID: 31548984
woolmilkporc made my problem very easy to understand!
0
 

Author Comment

by:AIX25
ID: 23687002
I have an open question if you would like to help and are good at shell scripting.
ID: 24159752

Thank you for all your help!
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question