Operating System - HP-UX
1834366 Members
2075 Online
110066 Solutions
New Discussion

Proper Way of Adding rc Startup Scripts on HPUX

 
SOLVED
Go to solution
Alzhy
Honored Contributor

Proper Way of Adding rc Startup Scripts on HPUX

I add in the script in /sbin/init.d .. make it executable and create K or S scripts in /sbin/rc?.d . However, during startup and shutdown i get Script Usage syntax Message on the console, ie:

Usage: /sbin/rc3.d/S99bootalert { start | stop } .................... OK

However, script runs correctly... My rc scripts does not echo out anything..

Hakuna Matata.
6 REPLIES 6
Hai Nguyen_1
Honored Contributor

Re: Proper Way of Adding rc Startup Scripts on HPUX

Hi,

This line must come from the "start" or "*" option in the "case" statement of your rc start script.

Hai
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Proper Way of Adding rc Startup Scripts on HPUX

Here is my best guess:

HP-UX adds 2 other non-standard command line options that most UNIX'es don't have. They are "start_msg" and "stop_msg". The command with these arguments are sent before the more traditional "start" and "stop" commands are executed. I suspect that your script does not handle these arguments correctly. Look at /sbin/init.d/template and model your script upon it.
If it ain't broke, I can fix that.
Michael Tully
Honored Contributor

Re: Proper Way of Adding rc Startup Scripts on HPUX

Did you use the script template that is provided? See /sbin/init.d/template
It has the case statements already done for you.
Anyone for a Mutiny ?
Sridhar Bhaskarla
Honored Contributor

Re: Proper Way of Adding rc Startup Scripts on HPUX

Hi Nelson,

When the system boots up, rc will try to run the scripts from /sbin/init.d directory. The order and the run levels are decided based on the links created in /sbin/rc*.d directory. The system runs these scripts with "start_msg and start" arguments during the startup and "stop_msg and stop" arguments during the shutdown. So, you will need to have these 'case' statements in your script. You are basically missing start_msg and stop_msg cases to display the status messages on the screen.

Look at /sbin/init.d/template file for an example. It is a good idea to create a control file under /etc/rc.config.d directory. For ex., look at /sbin/init.d/sendmail script and see how it works.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Michael Schulte zur Sur
Honored Contributor

Re: Proper Way of Adding rc Startup Scripts on HPUX

Hi,

you should have one script in /sbin/init.d
with a start and a stop section.
What you have in /sbin/rc?.d
are just logical links. S scripts are called S99bootalert start and because it is link, it calles your script in init.d

Michael
Alzhy
Honored Contributor

Re: Proper Way of Adding rc Startup Scripts on HPUX

Silly me.. I should have noticed early in the various samples within /sbin/init.d ...

Thanks y'all... and for pinting me to the template.
Hakuna Matata.