- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Init Run Levels
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2008 11:57 PM
06-22-2008 11:57 PM
During installation I will have to install a service.
1. Can you give me a quick overview about the run-levels on HPUX 11.23 PARisc?
2. How do I create the S/K links on /sbin/rcX.d? is there any command for that, as the chkconfig on linux or create a soft link via "ln"?
3. Do you have a good HP documentation link for this subject?
tx.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 12:01 AM
06-23-2008 12:01 AM
Re: Init Run Levels
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 12:13 AM
06-23-2008 12:13 AM
Re: Init Run Levels
read the man page.
# man rc
regards,
mustafa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 12:16 AM
06-23-2008 12:16 AM
Solutionrun level directories contains scripts that will run while start up, while changing run levels ( up or down) or shutting down. While going down from rc3 to rc1 K scripts run, while going up from s1 to s3 S scripts run. S is for starting, K is for killing.
/sbin/init.d/ director is your directory where you'll put your script for start and kill. And the synax is below:
#!/sbin/sh
case "$1" in
start_msg)
echo "Start
;;
stop_msg)
echo "Stop
;;
'start')
;;
'stop')
# Stop the oracle databases
;;
esac
and after you should create links for Rc directories. change
ln -s /sbin/init.d/
ln -s /sbin/init.d/
Kenan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 12:48 AM
06-23-2008 12:48 AM
Re: Init Run Levels
ln -s ... /sbin/rc3.d/S999
ln -s ... /sbin/rc3.d/K999
Typically these numbers add to 1000, so that they are done in reverse order.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 02:11 AM
06-23-2008 02:11 AM
Re: Init Run Levels
I wonder about those numbers... (Knnn/Snnn)
As I saw and also as dennis said, these number will complete to 1000.
For all the UNIX I know, the complition it to 100.
so,
1. are the lower number reserved for something?
2. what is the reason for these higer number?
3. if I have a service that for all the other UNIXes started at 91 and killed on 09 - what numbers you suggest me to set?
tx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 02:15 AM
06-23-2008 02:15 AM
Re: Init Run Levels
1. if my service uses networking - basically I can start it on level 2 - don't I?
2. it this acceptable to do so?
3. I saw that most of the sevices/daemons don't have a kill script on level 0 - what should happen on system shutdown? (should I put K links on level 0, 1?
tx again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 02:29 AM
06-23-2008 02:29 AM
Re: Init Run Levels
No, except they are done first.
>2. what is the reason for these higher number?
The range from 000 to 999? For more choices.
Note these numbers are an illusion. The scripts are done in ascii order and the reverse.
>3. if I have a service that for all the other UNIXes started at 91 and killed on 09 - what numbers you suggest me to set?
Probably 901 and 009.
>1. if my service uses networking - basically I can start it on level 2 - don't I?
You have to order it after the networking starts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 03:03 AM
06-23-2008 03:03 AM
Re: Init Run Levels
should I put K link there?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 03:11 AM
06-23-2008 03:11 AM
Re: Init Run Levels
What about the fact that when I reboot the machine I don't see my product in the printed down list:
XXX daemon was stopped.........OK
bla bla is down................OK
should I do something specific in order to get in this list?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 03:41 AM
06-23-2008 03:41 AM
Re: Init Run Levels
rc(1M) says that S is at rcN.d and K is at rcN-1.d.
>What about the fact that when I reboot the machine I don't see my product in the printed down list: should I do something specific in order to get in this list?
Do you have start_msg & stop_msg entry as Kenan mentions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 04:03 AM
06-23-2008 04:03 AM
Re: Init Run Levels
I don't use these names? should I? I have functions "stop" and "start"...
by the way.
I didn't understant the issue with init script:
If I want my service to be started for level 3 and above and be down for level 2 and below, where should I put my links? because somehow, when I'm on level 3 and I moved to level 4 with "init 4" the system runs my S link from rc4.d and fails.
shouldn't it recognize the the service is already up? should I remove the S link from rc4.d?
tx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 04:06 AM
06-23-2008 04:06 AM
Re: Init Run Levels
The manpages for 'rc(1M)' and the original 10.0 whitepaper on system startup scripts (which *still* applies today) provide a complete overview of the requirements you should meet.
The "rule of 1000" as mentioned, the difference betweent the number assigned to a start script and a kill script is discussed.
Use '/sbin/init.d/template' as a starting model for any script you write. In this way, you will follow the essential rules noted in the documentation.
http://docs.hp.com/en/934/startup.pdf
http://docs.hp.com/en/B2355-60130/rc.1M.html
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 05:19 AM
06-23-2008 05:19 AM
Re: Init Run Levels
I already have a file that works on all the other platform. Can I make it work with minimal changes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 05:28 AM
06-23-2008 05:28 AM
Re: Init Run Levels
> I can go with this template but am I required to? I already have a file that works on all the other platform. Can I make it work with minimal changes?
You are *not* required to use the template, but you *are* required to follow the same logic. This logic is also discussed in the aforementioned documentation I cited.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 05:51 AM
06-23-2008 05:51 AM
Re: Init Run Levels
but,
will it be acceptable to use a script that doesn't have "stop_message" and "start_message" for example (and "start_proc" instead "start")
do I have to use the rc.config.d/xxx file?
tx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 06:30 AM
06-23-2008 06:30 AM
Re: Init Run Levels
> but, will it be acceptable to use a script that doesn't have "stop_message" and "start_message" for example (and "start_proc" instead "start")
NO. You need to look at the documentation and the 'template' logic. These requirements are clearly documented. If you want your script to participate in startup and shutdown in HP-UX then follow the HP-UX guidelines!
You are making this much more difficult than it needs to be.
> do I have to use the rc.config.d/xxx file?
This is somewhat optional. However, by declaring variables in a file in '/etc/rc.config.d/' you can easily disable your startup and shutdown script without having to unlink the 'sbin/rc?.d' files from the '/sbin/init.d/' script. Look at '/etc/rc.config.d/mailservs' and '/sbin/init.d/sendmail' for one example of this mechanism.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 07:04 AM
06-23-2008 07:04 AM
Re: Init Run Levels
I understand that.
let me give you the following scenario:
I have script on /sbin/init.d
S link on rc3
K link on rc2
If I run /sbin/init.d/my_s start twice, in the second time, I failed with the msg that the service is alreay up.
BUT,
if I move from level 3 to level 2 (the service is still up), and if I move from level 2 to 3, the sys tries to start the service again and it gets error msg from service - but not from the script as I expected.
How can I avoid that?
Why the script doesn't avoid this case?
tx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 07:18 AM
06-23-2008 07:18 AM
Re: Init Run Levels
> If I run /sbin/init.d/my_s start twice, in the second time, I failed with the msg that the service is alreay up.
Yes, that would be expected. You have done nothing to stop (kill) the first instance.
> BUT, if I move from level 3 to level 2 (the service is still up), and if I move from level 2 to 3, the sys tries to start the service again and it gets error msg from service - but not from the script as I expected.
Then your shutdown ("K"ill) script failed to stop the first instance of your process.
There are any number of good examples if you look at the scripts in the '/sbin/init.d' directory.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 07:49 AM
06-23-2008 07:49 AM
Re: Init Run Levels
In my script, before starting it, I check that the service is yet up!
if it's up, I print the msg that the service is alreay started.
According to documentation (if I got it right) when I have S script on level 3 and K script on level 2, when I move from level 3 to 2, the Kill script on rc2.d shouldn't be invoked (only the K scripts from level 3)
that's why the service is still up when I moved from 3 to 2.
you understand my problem here?
also, I will look at more examples, but if you have some enlighment I will be happy to hear.
tx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 08:15 AM
06-23-2008 08:15 AM
Re: Init Run Levels
Your kill script has a problem in stopping (killing) your process(es).
The 'rc' manpages are very clear: "If a start script link e.g., /sbin/rcN.d/S123test) in sequencer N has a stop action, the corresponding kill script should be placed in sequencer N-1 (e.g., /sbin/rcN-1.d/K200test). Actions started in level N should be stopped in level N-1"
Instead of testing your scripts by rebooting, start by using them from the command line to start and stop correctly.
When you are satisfied with their behavior there you can examine the '/etc/rc.log' and 'etc/rc.log.old' to see the actions taken during startup and shutdown.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 11:48 PM
06-23-2008 11:48 PM
Re: Init Run Levels
The main problem is that when I run those scripts from the command line everything works fine but when I run the *init* command I get the mentioned problem ....
That's the reason I'm digging in this.
tx again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 11:53 PM
06-23-2008 11:53 PM
Re: Init Run Levels
Perhaps when you run it from the command line you should use env(1):
# env -i rc-script
This removes all of the environment variables and would be a better simulation of rc(1m).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 11:54 PM
06-23-2008 11:54 PM
Re: Init Run Levels
why do you think I have a problem with the stop operation.
according to the documentation, when I move from level 3 to 2 - only the K script of level 3 should be invoked - isn't it?
should I put the K script also on level 3 instead on level 2?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2008 11:57 PM
06-23-2008 11:57 PM
Re: Init Run Levels
Even with the *env -i rc-script* everything works great from the command line.
Any idea?