- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- startup script
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
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-14-2007 02:03 AM
11-14-2007 02:03 AM
I have a command to start the application and stop the application.Please let me know how can i create a startup and shutdown scripts with this command so that no need for doing this manually when system reboot or shutdown.please help.
Thanks Much
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2007 02:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2007 02:09 AM
11-14-2007 02:09 AM
Re: startup script
All lazy (good) sysadmins minimize their work here.
I generally take either /sbin/init.d/template or /etc/sbin/init.d/cron (or crond) and make a copy.
Then I modify this script to actually start/stop my new application.
Then I softlink to it in the /sbin/rc3.d directory for Start and /sbin/rc2.d dirctory for Kill
SEP
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
11-14-2007 02:11 AM
11-14-2007 02:11 AM
Re: startup script
You can use this file to create your own /sbin/init.d script
#!/sbin/sh
case $1 in
'start_msg')
;;
'stop_msg')
;;
'start')
;;
'stop')
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
exit
And you must link this file to related /sbin/rc#.d/ directories to start and stop automatically
Best Regards
Murat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2007 02:17 AM
11-14-2007 02:17 AM
Re: startup script
First go to /sbin/init.d, thats where alle the start/stop-scripts are located. Take one, copy it to a name that suits its new use, and modify it to stop and start using the commands you already got. The stop/start-framework in these scripts are pretty easy to figure out, so that should be no big deal.
Then go to /sbin/rc3.d to create a link, which uses the script above to startup the application. It has to be called something like S
ln -s /sbin/init.d/
If the application is dependent on some other startupscripts, please make sure that its S
Make the same in /sbin/rc2.d
in /sbin/rc1.d and /sbin/rc0.d you will make something like this, but here it should start with a "K", and is used for shutdown. If other applications are dependent on yours, make sure yours are shut down before those (lesser number).
That should be it.
Yours
Danny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2007 02:17 AM
11-14-2007 02:17 AM
Re: startup script
In addition to the 'rc(1M)' manpages as Pete suggested, you can use this whitepaper:
http://docs.hp.com/en/934/startup.pdf
While written at the inception of 10.0, it applies to all current releases of HP-UX. The manpages for later releases document a return code of four (4) whereas the original whitepaper didn't.
Be sure to use the '/sbin/init.d/template' as a starting point. You need to provide the various cases for *your* startup script to interact correctly with the '/sbin/rc' driver code.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2007 02:18 AM
11-14-2007 02:18 AM
Re: startup script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2007 02:20 AM
11-14-2007 02:20 AM
Re: startup script
The rule is that the kill script goes in one run-level below that of the start script.
e.g If your start script is
/sbin/rc3.d/S910application then your kill script should be /sbin/rc2.d/K090application.
The other convention (though not a requirement) is that the 3 digits of both scripts should add to 1000. This almost always brings them up and down in the intended order. I have also implemented my applications to start in rc4.d and stop in rc3.d assuming the default run-level is 4.
Best Regards, Ernesto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2007 03:51 AM
11-14-2007 03:51 AM
Re: startup script
Could you please some one see the below script has any flaw...Thanks Much
# more apache
#!/sbin/sh
case $1 in
'start_msg')
echo "Start http server"
;;
'stop_msg')
echo "Stop http server"
;;
'start')
/websphere/ica/bin/apachetcl -k start
;;
'stop')
/websphere/ica/bin/apachetcl -k stop
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
exit
#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2007 03:58 AM
11-14-2007 03:58 AM
Re: startup script
If so, you would want to add something like this after the 'start') clause:
if [ -f /etc/rc.config.d/apache ] ; then
. /etc/rc.config.d/apache
else
echo "ERROR: /etc/rc.config.d/apache defaults file MISSING"
fi
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2007 08:43 AM
11-14-2007 08:43 AM
Re: startup script
Attached is an old doc that still works for what you are attempting. Note that it also supplies the technique used to test the process without actually shutting down or starting up.
Regards,
-dl