- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Start & Kill scripts in rc*.d
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
Discussions
Discussions
Discussions
Forums
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
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
тАО08-28-2009 02:26 AM
тАО08-28-2009 02:26 AM
I am trying to put start & kill files in rc*.d folders.
At the moment my S* scripts are getting executed from rc3.d, but K* scripts are not getting executed from and of the rc*.d folder.
Here is my script:
start)
echo "Start rc0 `date`" >> /etc/init.d/log
;;
stop)
echo "Stop rc0 `date`" >> /etc/init.d/log
;;
*)
echo Invalid $1 >> /etc/init.d/log
;;
esac
Have put the K scripts rc0.d, rc1.d, rc2.d & rc3.d
After the system reboot, i could see only "Start rc3" entry in my log file (/etc/init.d/log)
Could somebody help me in solving why the K scripts are not getting executed.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 02:40 AM
тАО08-28-2009 02:40 AM
Re: Start & Kill scripts in rc*.d
There is a document on this, but here is the quick run.
Startup script must be in /sbin/init.d (HP-UX)
soft link the S start script in /sbin/rc3.d pointing to startup script.
Kill script is soft linked in /sbin/rc2.d pointing to the same script.
When starting from scratch:
cd /sbin/init.d
cp template myscript
# edit myscript
cd /sbin/rc3.d
ln -s /sbin/init.d/myscript S70myscript
cd /sbin/rc3.d
ln -s /sbin/init.d/myscript K30myscript
That is the basics.
SEP
hpuxadmin in gtalk
hpuxconsulting in yahoo messenger
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 02:41 AM
тАО08-28-2009 02:41 AM
Re: Start & Kill scripts in rc*.d
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 02:41 AM
тАО08-28-2009 02:41 AM
Re: Start & Kill scripts in rc*.d
To ensure that you are conforming to the correct rules with regard to the shutdown "K" scripts do a "man rc" or refer to the following link, which is still relevant even though it relates to HP-UX 10.x :
http://docs.hp.com/en/934/startup.pdf
Regards,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 03:25 AM
тАО08-28-2009 03:25 AM
Re: Start & Kill scripts in rc*.d
I have made the changes according to the document, still can't get the K* scripts getting executed.
As you people have suggested, my scripts are in /sbin/init.d & all rc*d folers have links.
bash-2.05# find /sbin -name "K990server" -exec ls -l {} \;
lrwxrwxrwx 1 root sys 19 Aug 28 16:46 /sbin/rc2.d/K990server -> /sbin/init.d/server
lrwxrwxrwx 1 root sys 19 Aug 28 16:46 /sbin/rc1.d/K990server -> /sbin/init.d/server
lrwxrwxrwx 1 root sys 19 Aug 28 16:46 /sbin/rc0.d/K990server -> /sbin/init.d/server
lrwxrwxrwx 1 root sys 19 Aug 28 16:46 /sbin/rc3.d/K990server -> /sbin/init.d/server
bash-2.05# find /sbin -name "S990server" -exec ls -l {} \;
lrwxrwxrwx 1 root sys 19 Aug 28 16:47 /sbin/rc3.d/S990server -> /sbin/init.d/server
Any thoughts what i may be missing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 03:26 AM
тАО08-28-2009 03:26 AM
Re: Start & Kill scripts in rc*.d
The script you showed in your first message seems to be incomplete: the beginning of the "case" statement is missing. If your actual script has this error, this may cause strange behaviour.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 03:38 AM
тАО08-28-2009 03:38 AM
Re: Start & Kill scripts in rc*.d
In /etc/rc.log, I could see a single entry of S990server without any error.
However, couldn't find a single entry of K990server.
What could be the reason.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 03:48 AM
тАО08-28-2009 03:48 AM
Re: Start & Kill scripts in rc*.d
Are you replicating the same kill script at every run-level as your post suggests? If so, this isn't correct nor necessary.
Remember that the environment provided to the run-level scripts is sparse. That is, unless you specifically provide variables that you normally have in a login session, they will not be present. Too, the PATH is limited.
Does your script run successfully to kill your process(s) if you execute it at the commandline?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 03:56 AM
тАО08-28-2009 03:56 AM
Re: Start & Kill scripts in rc*.d
I couldn't figure out whether my service was getting stopped or just killed due to system boot.
Hence, at the moment this is my only script.
This doesn't have any command that should require the full path. The only ones used are "echo" & "date" which should be available to all environments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 03:57 AM
тАО08-28-2009 03:57 AM
Re: Start & Kill scripts in rc*.d
Yes, if i run it, it adds the stop statement in /etc/init.d/log file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 05:09 AM
тАО08-28-2009 05:09 AM
Re: Start & Kill scripts in rc*.d
For the K* scripts you need to look in /etc/rc.log.old.
When you reboot or shut down the system, entries for the shutdown (K* scripts) gets appended to the current /etc/rc.log.
When the system starts, /etc/rc.log gets moved to /etc/rc.log.old. So there will only be entries for Startup.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 05:18 AM
тАО08-28-2009 05:18 AM
Re: Start & Kill scripts in rc*.d
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 05:20 AM
тАО08-28-2009 05:20 AM
Re: Start & Kill scripts in rc*.d
bash-2.05# find /sbin -name "S990server" -exec ls -l {} \;
lrwxrwxrwx 1 root sys 19 Aug 28 16:47 /sbin/rc3.d/S990server -> /sbin/init.d/server
"
note that if you use S990server at run level 3, the usual kill script would be K010server at run level 3. Output from the kill script would be in th old log, as noted previously. In that way, they start in the numerical sequence indicated by the S# and stop in the reverse order (last started becomes the first stopped)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 06:03 AM
тАО08-28-2009 06:03 AM
Re: Start & Kill scripts in rc*.d
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 07:10 AM
тАО08-28-2009 07:10 AM
Re: Start & Kill scripts in rc*.d
That is the common convention, but it is not a system requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 07:19 AM
тАО08-28-2009 07:19 AM
Re: Start & Kill scripts in rc*.d
As Patrick notes, that's the convention. I don't see any difference between that statement and what I illustrated, either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 07:36 AM
тАО08-28-2009 07:36 AM
Re: Start & Kill scripts in rc*.d
>>I still say this, that the sum of S number and K number should be 1000.
If you examine the original whitepaper from 10.0 (referenced above and here) you will read:
http://docs.hp.com/en/934/startup.pdf
/*begin_quote*/
Subsystems are killed in the opposite order they were started. This implies that kill scripts will generally not have the same numbers as their start script counterparts. For example, if two subsystems must be started in a given order due to dependencies (e.g., S111sys1 followed by S222uses_sys1), the counterparts to these scripts must be numbered so that the subsystems are stopped in the opposite order in which they were started (e.g., K555uses_sys1 followed by K777sys1). Also, kill scripts for start scripts in directory /sbin/rcN.d reside in /sbin/rc(N-1).d.
/*endof_quote*/
Hence, the "delta-of-1000" makes it easy to conform to this, given the 3-digit sequence number notation.
I would agree that for most folks with a small number of application scripts to start/stop, following this guideline (rule) may not make any difference.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2009 08:05 AM
тАО08-28-2009 08:05 AM
Re: Start & Kill scripts in rc*.d
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-30-2009 11:36 PM
тАО08-30-2009 11:36 PM
Re: Start & Kill scripts in rc*.d
Here is the present status:
Changed the script to comply with "Script Output" section of rc man page. Now i am just echoing messages & not redirecting.
case $1 in
start)
echo "Start Test Server `date`"
;;
stop)
echo "Stop Test Server `date`"
;;
*)
echo Invalid $1
;;
esac
Since adding up to 1000 is just a convention, I haven't changed that yet.
Below is the output of /etc/rc.log
[snip]
Invalid start_msg
Output from "/sbin/rc3.d/S990server start":
----------------------------
Start Test Server Mon Aug 31 13:00:26 IST 2009
[/snip]
The first line "Invalid start_msg" states i haven't implemented the start_msg call. Does it make any difference. The "start" call is getting executed which is what i need.
I am not getting a single of K in /etc/rc.log.old leave alone my script "K990server"
Any thoughts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-30-2009 11:54 PM
тАО08-30-2009 11:54 PM
Re: Start & Kill scripts in rc*.d
Did you checked the permission of your K script...
double check if you made any link.
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2009 12:00 AM
тАО08-31-2009 12:00 AM
Re: Start & Kill scripts in rc*.d
bash-2.05# ls -l /sbin/init.d/server
-rwxrwxrwx 1 root sys 169 Aug 31 12:56 /sbin/init.d/server
Manually running the script with "start" & "stop" parameters echoes the desired output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2009 01:30 AM
тАО08-31-2009 01:30 AM
Re: Start & Kill scripts in rc*.d
Can you paste output of your Startup and Kill file both.
ls -l Sfile and ls -l Kfile
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2009 01:50 AM
тАО08-31-2009 01:50 AM
Re: Start & Kill scripts in rc*.d
lrwxrwxrwx 1 root sys 19 Aug 28 16:46 /sbin/rc2.d/K990server -> /sbin/init.d/server
lrwxrwxrwx 1 root sys 19 Aug 28 16:46 /sbin/rc1.d/K990server -> /sbin/init.d/server
lrwxrwxrwx 1 root sys 19 Aug 28 16:46 /sbin/rc0.d/K990server -> /sbin/init.d/server
lrwxrwxrwx 1 root sys 19 Aug 28 16:46 /sbin/rc3.d/K990server -> /sbin/init.d/server
bash-2.05# find /sbin -name "S990server" -exec ls -l {} \;
lrwxrwxrwx 1 root sys 19 Aug 28 16:47 /sbin/rc3.d/S990server -> /sbin/init.d/server
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2009 09:26 PM
тАО08-31-2009 09:26 PM
Re: Start & Kill scripts in rc*.d
I am giving "reboot" command. Does that make any difference?
eg: On Solaris to execute K* scripts you have to give "init 6" and not reboot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2009 09:52 PM