- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: shell 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
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
03-03-2003 01:06 PM
03-03-2003 01:06 PM
I have a process that needs to be up all times. I would like to do a script that when this process dies the server will do a reboot.
How can I do that ?
Regards,
Tal.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2003 01:08 PM
03-03-2003 01:08 PM
Re: shell script
Why would you reboot a box when a process dies? Why would you not respawn the process?
Regards.
RZ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2003 01:10 PM
03-03-2003 01:10 PM
Re: shell script
You could write a script and put the entry into the /etc/inittab file with an action of 'respawn', which start the script at boot [depending on the run level you specify] and restart the script if it dies. Rebooting the box is pretty hard core, but I guess it could be done. You can't live with just restarting the process?
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2003 01:12 PM
03-03-2003 01:12 PM
Re: shell script
Or can you ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2003 01:16 PM
03-03-2003 01:16 PM
Solution#!/bin/ksh
APP=yourapplication
while true
do
PID=`ps -ef|grep $APP|awk '{ print $3 }'`
if test $PID
then
sleep 60 #or some other number, in seconds
else
reboot
fi
done
Its a much better idea to find out why your application is dying, and fix it.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2003 01:26 PM
03-03-2003 01:26 PM
Re: shell script
service restart dhcpd
That will restart the server daemon.
Surely there is a command for root user that restarts the client process.
Reboot is not the answer.
Trapping, tracking and fixing the error is harder but the right way to go.
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
03-03-2003 01:29 PM
03-03-2003 01:29 PM
Re: shell script
and you got to take a look at the current options you had setup for dhcpclient at startup in order to run the command exactly with the same options.
# /usr/lbin/dhcpclient -h
would give brief usage.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2003 01:36 PM
03-03-2003 01:36 PM
Re: shell script
dhcpclient -m lan0
or whatever lanx number you want to maintaint the lease. Dchpclient renews the lease then calculates the time that it needs to sleep before it wakes up and tries to renew the lease again. Usually dhcp clients need to try a renew half way through the lease period.
man dhcpclient
Good luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2003 01:37 PM
03-03-2003 01:37 PM
Re: shell script
how can I find out why the process is dying all the time ?
T.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2003 01:47 PM
03-03-2003 01:47 PM
Re: shell script
To maintain the lease for the interface lan0 and invoke logging in syslog, the following set of commands is invoked at the command prompt:
dhcpclient -b lan0 -N "dhcp1"
dhcpclient -m lan0 -N "dhcp1" -l 3 -t 1