Operating System - HP-UX
1824836 Members
3753 Online
109674 Solutions
New Discussion юеВ

detect remote host is up or not

 
SOLVED
Go to solution
Gary Yu
Super Advisor

detect remote host is up or not

Hi,

I'm writing a /sbin/init.d script to start our Apps at system boot time. We are using a Client/Server architecture and I have to use "remsh" to start some process on other hosts(client) from this server. the /sbin/init.d script only run on one host which is the root host.

In a scenario that all client/server hosts are reboot at same time, the client hosts may come up later than the server host, so in the script I have to detect whether the remote hosts are up or not before issue the remsh commands, I'm just wondering what's the best way to do that -- ping the host or just run a "remsh ls" or some better way ...

looking forward to your suggestions,

thanks and have a nice day.

Gary
5 REPLIES 5
Steve Steel
Honored Contributor
Solution

Re: detect remote host is up or not

Hi

ping will answer you before the machine is completely up.

I would do something like

remsh topaz who -r|grep "run-level 3"

To check when the machine is at the correct run level.


Alternatively let the machiens all run 1 script in startup and shutdown that makes and
removes a file called machineon or similar.

Chekc for that and machine is not there if not found so maintenance and emergencies are all solved by removing the file


Steve steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Dirk Wiedemann
Respected Contributor

Re: detect remote host is up or not

Hello Garry,

a simple workaround:
write a sleep-statement before the remsh-command.
For example: sleep 600 make the script waiting for 10 minutes and meanwhile all servers should be up.

Dirk
A. Clay Stephenson
Acclaimed Contributor

Re: detect remote host is up or not

Pinging is probably not good enough because the network services may be up but your required service may not. Whenever, I need to setup complicated related processes across servers, I prefer to use a pair of Perl client/server socket scripts to coordinate these activities. The clients have built-in timeout routines.


I explained this pretty well and attached the Perl pieces along with shell script snippets calling these Perl scripts in this thread:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x312e8f960573d611abdb0090277a778c,00.html
If it ain't broke, I can fix that.
Sajid_1
Honored Contributor

Re: detect remote host is up or not

hello,

the simple way will be to use the 'ping' command. If you want take a look at this man page too:

# man ruptime
learn unix ..
Gary Yu
Super Advisor

Re: detect remote host is up or not

thank you guys for all the suggestions, I think I will go with 'who -r | grep "run-level 3" ', it's easy to implement.