In modern workplaces, it is unreasonable to expect system administrators to manually run commands across vast numbers of servers. It is simply inneficient and unessesary. In order to resolve this many remote administration tools have been created. Tools vary from distributed shells to configuration management sofware. These tools may be overkill for smaller environments. To add to the multitude of distributed tools the following Perl script was created. Using the script is simple. First change the @bsdhosts array elements to the hostnames in your environment. Second, change the word "user" to a valid username that can ssh into the remote hosts. Finnally, change `pwd;ls` to whatever command needs to be performed on the remote hosts. To run multiple commands within one session, simply use a semicolon to seperate the commands as shown below. Passwords can be avoided by using `keygen`. There are many sites describing how to do this on the net. Here is one such location to get you started http://gentoo-wiki.com/SECURITY_SSH_without_a_password . In short, for a small environment where there is no need for a complex distributed solution a simple Perl script can step up to the task. Enjoy!
#!/usr/bin/perl ########################################################### # Summary: An easily modified script to run remote commands. # # Last modified: 01/30/2008 # # Author: Javier Prats # ########################################################### use warnings; use diagnostics; use strict; our $counter; our @bsdhosts=qw(hostname1 hostname2 hostname3 hostname4); foreach $counter (@bsdhosts) { my @command= ("/usr/bin/ssh user\@$counter pwd;ls"); system(@command); }
2 comments:
Keep up the good work.
[url=http://www.adulthostedblogs.com/?u=videosealea4]OJOsoft FLV to AVI Converter[/url] [url=http://www.drawingboard.org/blogs/?u=videosearchie8]Joost Video Player 1.0[/url]
Die Hard Video Converter 2.0 Nidesoft 3GP Video Converter 2.1.62
http://www.pinskerdream.com/bloghoster/?u=videosealine6 AML Power Video Converter
[url=http://www.blogportalen.no/blog/?u=videosealanis4]Apex Video Converter Super 6.17[/url] [url=http://www.drawingboard.org/blogs/?u=videosealban0]Wondershare DVD Ripper Platinum 3.2.50[/url]
Okoker All Video Splitter 6.4 Daniusoft Digital Video to ZEN Converter
http://www.pinskerdream.com/bloghoster/?u=videoseangelia4 VideoCacheView
No 1 DVD Ripper 7.2
my icq:858499940385
Post a Comment