- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to run a script when the system shuts down
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
11-04-2004 07:34 PM
11-04-2004 07:34 PM
How to run a script when the system shuts down
I've a simple question for everyone is expert of HP-UX.
I'd like to run some emergency scripts when the system is suddenly shutdown, for instance when the power is discontinued, or even when the a shutdown is required by the "reboot" system command.
I knew that the system passes automatically through lower run levels, and it's possible to "link" some scripts to these run level transition; any more informations? is it true?
Thanks a lot
Enrico
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 07:46 PM
11-04-2004 07:46 PM
Re: How to run a script when the system shuts down
E.G. If you want o kill a certain daemon, (running in level 3) when shutdown/reboot is executed, you can put a script (kill script) in level 2 and link it to /sbin/init.d/xx script.
Also if you are worried about what will happen to system, when power goes off/has problems, you can set ups.conf file. (This comes with some UPS vendors)
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 07:49 PM
11-04-2004 07:49 PM
Re: How to run a script when the system shuts down
start and stop scripts in HP-UX are in /sbin/init.d
in /sbin/rc2.d or /sbin/rc3.d you have S-tart links and K-ill links to that same script.
any k-linked script will be executed if you run shutdown command. *NOT* if you run reboot! Also not if you switch the system off, or reset it hard thorough GSP/MP
pls read
man rc
Regards,
Bernhard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 07:54 PM
11-04-2004 07:54 PM
Re: How to run a script when the system shuts down
agree with above comments but you will need a ups in case of power problems. Ups software will shutdown your server.
Best regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 07:58 PM
11-04-2004 07:58 PM
Re: How to run a script when the system shuts down
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 08:21 PM
11-04-2004 08:21 PM
Re: How to run a script when the system shuts down
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 08:24 PM
11-04-2004 08:24 PM
Re: How to run a script when the system shuts down
Info given is all good but since a power loss may take out your network you need to decide what you need.
If it is only a few small files then just run a cron job which checks for any of the files being changed since the last run and copies them.
You can use the newer function of find to check for changes
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 08:44 PM
11-04-2004 08:44 PM
Re: How to run a script when the system shuts down
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2004 10:53 PM
11-04-2004 10:53 PM
Re: How to run a script when the system shuts down
When you are writing start / kill script then, you have to use full path to that binary as like,
/usr/bin/ls etc. Else use PATH variable there. It can not identify that PATH informations.
Try to select appropriate startup number as, Kxxx to make execute without getting problem because of related service killing there.
See more on man rc
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2004 11:02 AM
11-08-2004 11:02 AM
Re: How to run a script when the system shuts down
Perhaps, this is stating the obvious, but if the power is cut without a UPS, the system will simply shutoff with no orderly shutdown and no scripts will have time to run. Even with a UPS, some monitoring should page you on power failures to allow time for a manual or automated safe shutdown.
Regarding copying some files off before shutdown completes, yes, a kill rc script (as described above) could copy off some files. I'm just curious why would you want to do that? How will you use these files with the server shutdown - another system?
Thanks. - Mike