Operating System - HP-UX
1819955 Members
3370 Online
109607 Solutions
New Discussion юеВ

Shutdown server using remsh

 
SOLVED
Go to solution
Yogeeraj
Advisor

Shutdown server using remsh

Hello experts,

I have 2 servers on my site that are totally dependent. One is running my database and the other my application server.

I have a UPS monitoring software that shutdowns the Database server when a long power cut occurs. I cannot use the monitoring software on my Application server.

I have already setup my remsh environment and done simple tests. IT works.

I have configured shutdown scripts (/sbin/rc0.d/K001shutdownLclass and appropriate files) to contain shutdown commands to run on the remote host (Application Server). IT DOES NOT WORK!!

During the shutdown of my database server, i can see the Message that i had included in the script but nothing happens on the remote host...

Anyone please guide me.

thanks in advance
Yogeeraj
6 REPLIES 6
Steven Sim Kok Leong
Honored Contributor

Re: Shutdown server using remsh

Hi,

Just a note. For shutdown to work, it must run from the / directory.

Check whether after you remsh'ed over, that your shutdown script cd to / before executing shutdown.

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Eugen Cocalea
Respected Contributor
Solution

Re: Shutdown server using remsh

Hi,

Read the man page for 'rc'. I suggest you put your kill script that sends the remote messages to the other server in rc2.d, before shutting down the network.

When the server is doing the transition to level 0, it passes the levels 2 and 1, where the network is stopped. Your script, being in rc0, is executed after the network is stopped so it would be a true wonder to work.

E.
To Live Is To Learn
James R. Ferguson
Acclaimed Contributor

Re: Shutdown server using remsh

Hi:

I agree with Eugen. You should take a look at the white paper below. It can be read very quickly and gives a complete definition of the rules for setting up startup and shutdown scripts. From this document you will note that run-level 3 is a networked, multi-user state. Generally this is where user startup scripts reside, with their kill couterparts one level lower as run-level 2.

http://docs.hp.com/hpux/onlinedocs/os/startup.pdf

Regards!

...JRF...
Roger Baptiste
Honored Contributor

Re: Shutdown server using remsh

<>

Timeout. It won't work since by the time
the system reaches runlevel 1 (to execute scripts under rc0.d directory), its network services are shutdown.

Put the script in /sbin/rc3.d . it should work fine. Also, in the script do a ping -n 5 remotehost and redirect the output to a logfile, such that you can confirm later whether the remote system is accessible during the script execution.

HTH
raj
Take it easy.
Steve Labar
Valued Contributor

Re: Shutdown server using remsh

I am running something similar at my site. I have one server on a smart UPS and one server connected to a UPS without smart features. As mentioned earlier, if you run the remsh in run level 0, there will be no network to support that commmand. I modified the script which the smart UPS executes to shutdown. In that script I included the remsh to shutdown the remote server. I did it as a background process as well, so the local host does not have to wait for the remote host to complete shutting down to continue its own shutdown sequence.

Hope this helps.

Stev
Kofi ARTHIABAH
Honored Contributor

Re: Shutdown server using remsh

In addition to Rajman's comments about running it from runlevel 3, you should also consider executing the remsh in the background - ie
remsh l2000 "cd / ; shutdown -h -y 0" &
do not wait for L200 to shutdown before proceeding with the shutdown. because if it takes forever for the app server to shutdown, you might run out of juice in your UPS.

nothing wrong with me that a few lines of code cannot fix!