Visit Our UNIX and Linux User Community


script to reboot multiple hosts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script to reboot multiple hosts
# 1  
Old 06-09-2011
script to reboot multiple hosts

Hi Expert,

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

Thank you.
# 2  
Old 06-09-2011
* 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.
# 3  
Old 06-09-2011
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
# 4  
Old 06-09-2011
Code:
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.
# 5  
Old 06-09-2011
Quote:
Originally Posted by regmaster
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
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.
Code:
# rsh rhserver2 reboot

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

regards
ygemici
# 6  
Old 06-10-2011
Thanks!

Previous Thread | Next Thread
Test Your Knowledge in Computers #737
Difficulty: Medium
In 1979, the TRS-80 had the largest selection of software in the microcomputer market.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ssh to multiple hosts and then run multiple for loops under remote session

Hello, I am trying to login to multiple servers and i have to run multiple loops to gather some details..Could you please help me out. I am specifically facing issues while running for loops. I have to run multiple for loops in else condition. but the below code is giving errors in for... (2 Replies)
Discussion started by: mohit_vardhani
2 Replies

2. Shell Programming and Scripting

Script to Run Multiple Systems Checks and mail me the results after every reboot- Linux

Hello, I'm trying to create a mechanism wherein a set of Production servers will email me the results of system checks like Uptime, NFS Mounts and a Process after every scheduled reboot. For this, I figured I'd use the @reboot parameter that crond comes with. I have added the below onliner... (3 Replies)
Discussion started by: pocodot
3 Replies

3. Shell Programming and Scripting

Check connectivity with multiple hosts - BASH script available here

Hi everyone! Some time ago, I had to check connectivity with a big list of hosts, using different formats (protocol://server:port/path/, server:port, ....). I developed a script that checks the connectivity using different commands (ping, telnet, nc, curl). It worked for me so I'm sharing it... (9 Replies)
Discussion started by: Fr3dY
9 Replies

4. Shell Programming and Scripting

How to write bash script for creating user on multiple Linux hosts?

I wonder whether someone can help me with what I'm trying to achieve Basically, the objective is one script to create new user on more than 70 linux hosts if required. Everything works apart from the highlighted part. It gave me an output passwd: Unknown user name ''. when try to set... (35 Replies)
Discussion started by: fugeulu
35 Replies

5. Shell Programming and Scripting

Running a script on multiple remote hosts at once

I have a script on about 15 hosts that I need to run for each host whenever I want (not crontab). Problem is, this script takes 5-10 mins to run for each host. Is there a way I can run the script in parallel for all the hosts instead of 1 at a time? Also, I'm remotely running the script on the... (3 Replies)
Discussion started by: mrskittles99
3 Replies

6. UNIX for Dummies Questions & Answers

Can you specify multiple mailhost's in the /etc/hosts file?

Hello, This question has been posted by another member previously, but no reply/answer was posted to that thread and it has been closed. Searches do not seem to turn up a straight answer as to whether or not this is possible. So I ask the same question: We recently had our SMTP server go... (2 Replies)
Discussion started by: kwasserb
2 Replies

7. UNIX for Dummies Questions & Answers

Can you have multiple mailhost's in the /etc/hosts file?

We recently had an smtp server go down and didn't have a backup. Now that the backup server is up and running, I'd like to set up sendmail on our Solaris 10 servers to failover to the backup mail (smtp) server if the primary refuses connections. I've googled "mailhost" and haven't found... (0 Replies)
Discussion started by: the.gooch
0 Replies

8. Shell Programming and Scripting

automate ftpget to multiple hosts

Hi Folks, I have scanned the threads all day and have not found anything close enugh to what I need. I'm probably more confused now than before. Here's what I'm trying to do: 1. automate for running in the early am. (I think I can handle the cron part) 2. get the newest file from a... (5 Replies)
Discussion started by: huntfishtrap
5 Replies

9. Shell Programming and Scripting

script for df output from multiple hosts

I am trying get "df -k" output from multiple hosts along with their hostnames via ssh, my script is appending the "df -k" output from all the nodes to a single file but not getting the hostnames for those nodes, just wondering how to pass more than one command via ssh or may be someone could come... (6 Replies)
Discussion started by: barkath
6 Replies

10. UNIX for Advanced & Expert Users

Copy a file to multiple hosts

Hi, I need to copy a file ( say 1MB file ) to multiple hosts( no of machines is huge). What would be the most optimal way of doing it with minimal user intervention ? Thanks, Sumit (5 Replies)
Discussion started by: sumsriva
5 Replies

Featured Tech Videos