Operating System - HP-UX
1829586 Members
2030 Online
109992 Solutions
New Discussion

Re: How to display message of service being loaded with rc3.d ??

 
SOLVED
Go to solution
Daniel Simard
Frequent Advisor

How to display message of service being loaded with rc3.d ??

Hi,
I have created a Script called S942sysperm.sh and I have placed it in rc3.d
The script executes no problem, it's just that I was wondering how to have a message displayed when it's executing. You know where it's going through all it's rc's (rc1.d rc2.d rc3.d) and you see OK, DONE, OK done, FAIL... Well, because my script is there you don't see anything just what's below

[ ] OK/DONE

If you guys need more explaination, please do not hesitate to let me know.
Thanks
Si tu n'as pas ce que tu aimes, aimes ce que tu as.
6 REPLIES 6
Marco Santerre
Honored Contributor

Re: How to display message of service being loaded with rc3.d ??

Daniel,

actually, if you look in /sbin/init.d, you'll find a script called template that actually includes a start_msg and a stop_msg portion in the script. It is those message that you see at boot up and shut down of your server.

I would also recommend following HP standards in placing your script in /sbin/init.d and linking your script in the rc3.d, or other levels.
Cooperation is doing with a smile what you have to do anyhow.
A. Clay Stephenson
Acclaimed Contributor

Re: How to display message of service being loaded with rc3.d ??

Look in /sbin/init.d and model your start/kill script on the file "template". HP-UX has a few extra conventions over "standard" UNIX - whatever that is.

In addition to the stand "start" and "stop" code sections, HP-UX adds "start_msg" and "stop_msg" sections and that is were your messages go. Pay attention to the return code values as descripbed in the template file for the "OK" and "FAIL" messages.

The other HP-UX convention is to have a config file in /etc/rc.config.d that is used to setup any needed variables. Typically a variable is set to 1 to allow the start/stop actions to occur and 0 to ignore.

If it ain't broke, I can fix that.
Jeff Schussele
Honored Contributor

Re: How to display message of service being loaded with rc3.d ??

Hi Daniel,

Firts off you should place the script in /sbin/init.d & create a link from /sbin/rc3.d to the file in /sbin/init.d. You should also have a stop function in this script & link from /sbin/rc2.d to the same script.

Now to the question:
Normally you'll have a case statement in the script with four parts - EX:

case "$1" in
start_msg)
echo "Starting whatever daemon"
;;
stop_msg)
echo "Stopping whatever daemon"
;;
'start')
/command/to/start/the/daemon
;;
'stop')
/command/to/stop/the/daemon

Take a look at some of the scripts already in /sbin/init.d & you'll get a feel for this. It's not that difficult.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Robin Wakefield
Honored Contributor

Re: How to display message of service being loaded with rc3.d ??

Hi,

In addition, the /sbin/rc & /sbin/rc.utils script interface to the startup checklist on the console.

rgds, Robin
Helen French
Honored Contributor

Re: How to display message of service being loaded with rc3.d ??

You need to modify your script to be in the rc script template model. What you can do is make a copy of one of the scripts in /sbin/init.d and insert your startup commands under start_msg and stop commands under stop_msg. It's just the way rc executes it's scripts.
Life is a promise, fulfill it!
Caesar_3
Esteemed Contributor
Solution

Re: How to display message of service being loaded with rc3.d ??

Hello!

Add to your script in the case part:
start_msg)
echo "THE WANTED START MSG"
;;
stop_msg)
echo "THE WANTED STOP MSG"
;;

And you will see it will work, you can check
by running: S942sysperm.sh start_msg
you will see the start msg

The OK/DONE/FAIL are depend on the return value that return by your script.

Caesar