Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AIX Startup Script

Status
Not open for further replies.

chrisleadingside

IS-IT--Management
Nov 17, 2003
6
MY
I am writing a startup script for AIX (see below) and it doesnt seem to be working. I have placed it into the appropriate rc2.d etc folders in /etc/rc.d/

is this right? I have placed my script (minus the commands) below. Could someone help me. at the moment everytime someone decides to restart the server I have to manually run the script by typing: ./startupscript start
(which works fine)

HELP!

Thanks
Chris

#!/bin/ksh
# Startup Script for AIX

case "$1" in
start )

;;
stop )

;;
restart )

;;
$0 stop
$0 start
;;
* )
echo "Usage: $0 start|stop|restart"
exit 1
esac
 
Hi,
The body structure of the script is right.
But if your script contains only one syntax error, it will not run! I hace experienced many problems.
To Debug this : put some prints to a log file like this:
start )
print "Begin starting" >> /tmp/rc.$0.log
....
print "End starting" >> /tmp/rc.$0.log
;;
stop )
print "Begin stopping" >> /tmp/rc.$0.log

;;

Also add an entry like this to check at every time if your application is up.

status)
print "Begin checking status" |tee -a /tmp/rc.$0.log
some commands to check your application is running well
ps -ef |grep "ora_????"
some other commands for checking
;;


hope this helps
Ali

 
AFAIK, AIX uses the file /etc/inittab to define startup procedures. Do a man inittab for the exact syntax for commands to be added to it. HTH.
 
To run in the /etc/rc.d dir system, you will need to name your script appropriately.

S99script

what is it's name?
 
the name is okay its S70infofusion or something similar

I was under the impression that inittab was used for system services??

Chris
 
I see AIX 5.1 started to support runlevels, but we still do it the old way from the inittab. It's a bit confusing because it goes up to rc9.d, different from e.g. Linux.

Would the multiuser environment be rc2.d (like Solaris) or rc3.d (like in Linux). The samples aren't very clear.


IBM Certified Confused - MQSeries
IBM Certified Flabbergasted - AIX 5 pSeries System Administration
MS Certified Windblows Rebooter
 
The bit which confuses me is that all the runlevels are called on from the inittab, so if I read it right then it shouldn't matter in which runlevel I plece the script.

Or have I got it totally wrong here?

IBM Certified Confused - MQSeries
IBM Certified Flabbergasted - AIX 5 pSeries System Administration
MS Certified Windblows Rebooter
 
No, only the current runlevel is called from inittab, all run levels are placed in inittab because every runlevel runs inittab, but, in

l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3

If you bring your machine up in runlevel 2 ONLY this line will execute
l2:2:wait:/etc/rc.d/rc 2

If you bring your machine up in runlevel 3 ONLY this line will execute
l3:3:wait:/etc/rc.d/rc 3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top