script to reboot multiple hosts

Hi Expert,

How to create a script to reboot multiple hosts in linux?

Thank you.

  • what is o.s in hosts?
  • how to be sure everything is properly before send to reboot ? (is there any application must be controlled )
  • if you use this , you must be sure from others are not/can not running this.

sorry did give enough details:

OS= RHEL5 Linux

rsh is enable, so rsh reboot hostname or rsh /usr/sbin/shutdown -r now will work.

What I need is to reboot multiple hosts and read from a file that contain name of hosts.

FOR or WHILE loop is ok.

Thanks

while read host
do
#your rsh command here with $host as hostname
done <host_list.txt

Hope you have taken care of all running applications and the inconsistencies.

rsh actually dont use secure channels.
(maybe with -x provides activate des about just input and output stream.
(like username, but already is not used because of probably you save to user credentials to .rhosts) .
some variants also does not support this also..

if you still want rsh , you can use this command if you start in.rshd in remote machines.

# rsh rhserver2 reboot

but you must certainly use ssh instead of rsh if security is important.

regards
ygemici

Thanks!