Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

using rsh command in perl

by Anonymous Monk
on Dec 22, 2001 at 15:32 UTC ( [id://133962]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I want to generate a report for all the users working in the office displaying the server & the no. of users home partitions hosted on a particular server.For that, i need to connect to each server ( using rsh <servername> ). Then go to a particular directory & count the no. of words of the output of "ls command" ( which will be the no. of users on that server). for this i'm using the following perl program but i'm not able to connect to the servers using "rsh" command in perl. can anyone please help me with that. The problem is to write a perl code, such that, using a foreach loop, i can log on to each server (one-by-one), then reach a particular directory on that server, execute a commnad to count the no. of users on that. Please reply me on sethji2@rediffmail.com Thanks, Sethji

Replies are listed 'Best First'.
Re: using rsh command in perl
by tachyon (Chancellor) on Dec 22, 2001 at 21:11 UTC

    Sadly requests from Anonymous Monk for personalised replies to me@home.com tend not to meet with enthusiastic responses. Perl can do all of what you want and more. To execute a command line command in perl you just enclose it in back ticks like this:

    my $output = `rsh blah blah`;

    The output of the command is caught by $output. For info on loops see tutorials

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: using rsh command in perl
by Anonymous Monk on Dec 22, 2001 at 20:28 UTC
    I do something like that to check the status of my servers.
    @hosts = qw(hosta hostb hostc); foreach $host (@hosts) { $status{$host} = `rsh -l ems $host /path/command`; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://133962]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-19 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found