- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- runnig shell script on many servers
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
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
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
тАО01-01-2006 01:22 PM
тАО01-01-2006 01:22 PM
I have a script available on one of the server. Is it possible to run it om many servers by executing on one server ?
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-01-2006 02:02 PM
тАО01-01-2006 02:02 PM
SolutionThat depends on what your shell script does. As long as it uses code that exists on the *other* servers, then "yes".
For example, if I wanted to collect the 'uname' information on a number of servers, I could do something like:
# for host in hostA hostB hostC
> do
> remsh -n 'uname -a'
> done
The key is that the 'uname' command is available on each host and is executed there.
If the server isn't setup for 'remsh' then you could substitute 'rexec'. See the manpages for 'remsh(1)' for more information.
Regards!
...JRF...
- Tags:
- remsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-01-2006 02:28 PM
тАО01-01-2006 02:28 PM
Re: runnig shell script on many servers
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-01-2006 05:33 PM
тАО01-01-2006 05:33 PM
Re: runnig shell script on many servers
or
ssh command to execute in remote machine
or
using expect script to give password and execute.
or using telnet + piping scripting as,
(
echo "root"
sleep 2
echo "passwd"
sleep 2
echo "
sleep 2
echo "exit"
) | telnet hostname
-Muthu
- Tags:
- ssh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-01-2006 05:39 PM
тАО01-01-2006 05:39 PM
Re: runnig shell script on many servers
http://expect.nist.gov/
http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.43/
-Arun
- Tags:
- expect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-02-2006 01:24 AM
тАО01-02-2006 01:24 AM
Re: runnig shell script on many servers
You could distribute and execute the script using SSH:
for HOST in A B C
do
scp myscript username@$HOST:/tmp/myscript
ssh $HOST /tmp/myscript
done
You might want to put in checks to make sure that the script is not executed if the transfer fails etc.
If you want to do this without entering passwords, you can setup "public-key authentication" - for more information take a look at this site: http://www.cvrti.utah.edu/~dustman/no-more-pw-ssh/
Regards,
Kasper
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-02-2006 08:05 PM
тАО01-02-2006 08:05 PM
Re: runnig shell script on many servers
if on the other server you have the same scripts and the same environment (same path, same aliases ans so on) the answer is yes.
I do teh same using remsh.
remeber to load the profile prior to execute your script on remote server.
man remsh for more info regarding the input/output redirection.
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2006 01:25 AM
тАО01-03-2006 01:25 AM
Re: runnig shell script on many servers
The typical environment where this is necessary is usually number crunching clusters.
That's why those folks already devised a whole bunch of cluster maintenance solutions.
Here are some such
http://www.llnl.gov/linux/pdsh/pdsh.html
http://www.csm.ornl.gov/torc/C3/
http://sourceforge.net/projects/dcmd/
http://tentakel.biskalar.de/
http://ganglia.sourceforge.net/
Most of those can be built with SSH integration.
I personally find PDSH pretty neat and easy to set up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2006 01:51 AM
тАО01-03-2006 01:51 AM
Re: runnig shell script on many servers
One other way to run a script on many servers is to put the script in a filesystem that is exported to all other systems. You can then run the script by mounting the filesystem on each of the NFS client machines.
For example, I have a backup script that I run nightly on a variety of servers. I installed the script on a Network Appliance partition called /backups. This partition is exported to all the servers at the site. Thus, I can put something like:
00 30 * * * /backups/backup.sh
in the crontab of each server. Of cource, you have to make sure that /backups is mounted on the various servers, or you cron job will fail.
Just another method...
Regards,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-07-2006 01:11 PM
тАО01-07-2006 01:11 PM
Re: runnig shell script on many servers
Ralph's reply above mentioned "pdsh" or Parallel Distributed
Shell. This open source tool included as part of the
Distributed Systems Administration Utility (DSAU) with
HP=UX 11.23 December 05 release.
pdsh would be a high performance option since it
would issue the command in parallel to the specified set of
systems. The target systems can be specified in a file, one
hostname per line.
You do have to configure rsh or non-interactive ssh for
pdsh. DSAU supplies the csshsetup tool to simply configuring
one-way or round-robin trust relationships for ssh.
Two other possible approaches:
- Use Systems Insight Manager. SIM has the Distributed Task
Facility (mxexec). This is conceptually similar to pdsh but
allows you to define role-based access control for
predefined commands/scripts.
- Use cfengine. cfengine is also included with HP-UX 11.23
December 05. You can use cfengine to distribute the script
to the managed clients and execute it there.
pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-09-2006 01:38 AM
тАО01-09-2006 01:38 AM