Sponsored Content
Full Discussion: Time out set in perl script
Top Forums Shell Programming and Scripting Time out set in perl script Post 302954780 by kumar85shiv on Friday 11th of September 2015 01:53:07 AM
Old 09-11-2015
Time out set in perl script

Hi,

I am preparing a perl script, which will run some commads on remote Linux servers.

I have a file contains all the servers names one by one like below

vi servers.txt

srv1
srv2
srv3

Now, I need to prepare a perl script to ssh (or)rsh to each server in the above file and get the uptime.

but the issue is, if the server is pinging and not able to ssh or rsh, then the script is getting hung.

can anyone suggested me to fix this, without using any perl modules.

here is my script

Code:
 
 #!/usr/bin/perl 
 use strict;use warnings;
  
 open (DATA, "<servers.txt") or die "no file, $!";
@srv = <DATA>;
close (DATA);
  
 $cmd = 'uptime';

 foreach $i (@srv) {
        chomp $i;
         $up = qx/rsh $i '$cmd';
         print " $i $up";
          }
 exit(0);

here the problem is, if the server is pinging but not able to login, then the script is not moving to another server.

please suggest me.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

I need to set a time limit for a script

Hello Folks, I have been asked to write a test script which can be run by students. the script should have a time limit. I have almost completed it except the bit of timing! I've seen something like this: on_timeout() { echo "$USER $score " >> theresult.txt echo "Time out!... (2 Replies)
Discussion started by: SultanKSA
2 Replies

2. Shell Programming and Scripting

time stamp perl script error out of range 1..31

Hi, while running the perl script i am getting this error message , Day '' out of range 1..31 at rsty.sh line 44 what do iam missing in the script, any suggestion #!/usr/bin/perl use Time::Local; my $wday = $ARGV; my $month = $ARGV; # convert the month shortname into 0-11 number if... (4 Replies)
Discussion started by: saha
4 Replies

3. Programming

Date time problem while executing perl script.

Hi All, This Monday 15th March 2010, i have faced a weired issue with my Perl script execution, this script is scheduled to run at 1 minute past midnight on daily basis ( 00:01 EST ) generally for fetching previous business date , say if it is Monday it should give last Friday date, for Tuesday... (0 Replies)
Discussion started by: ravimishra
0 Replies

4. Shell Programming and Scripting

Script to capture date/time in seconds in PERL... Cant understand errors

I'm Using this script to find the time of a file. I'm very much new to PERL and found this script posted by some one on this forum. It runs perfectly fine, just that it gives me following errors with the accurate output as well. I jus want the output to be stored in another file so that i can... (0 Replies)
Discussion started by: bankimmehta
0 Replies

5. Shell Programming and Scripting

Perl script that checks against Future time

Ok, so this may be an unusual request. But I have a certificate that expires sometime in may of 2011. Now, i have to monitor this certificate and alert when the current time is within 30 days of may 20, 2011. #!/usr/bin/perl # use Time::Local; # $sec=59; $min=59; $hours=23; $day=31;... (3 Replies)
Discussion started by: SkySmart
3 Replies

6. Shell Programming and Scripting

need shell or Perl script to get the epoch time automatically

I need shell or Perl script to get the epoch time automatically Example I need to execute mysql command to delete content less then given epoch time If date is 01-07-2010 (dd-mm-yy) epoch should be lees 7 days mean 23-06-2010 for 23-06-2010 I need epoch time Delete BS_table where... (1 Reply)
Discussion started by: sreedhargouda
1 Replies

7. Shell Programming and Scripting

How do i access sybase using isql and how do i get result set in perl script?

Hi, How do i get result set in perl script using isql while connecting sybase server. I have a perl script which connected to sybase and get the result set. but i wanted to get the result set. How do i get the result set in perl script not unix shell script.. $server ="ServerName"; open... (1 Reply)
Discussion started by: solo123
1 Replies

8. Shell Programming and Scripting

Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time.

How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ? Like in Shell script, we use tee, is there anything in Perl or any other option ? (2 Replies)
Discussion started by: butterfly20
2 Replies

9. Shell Programming and Scripting

Get the time difference between two consecutive line in UNIX perl script

Hi All :o, I have some log files which contains these informations: 2013-04-24 09:11:34.018 INFO XXXXXXXXXXXX 2013-04-24 09:11:34.029 INFO YYYYYYYYYYYY 2013-04-24 09:11:34.039 INFO ZZZZZZZZZZZZZZZ 2013-04-24 09:12:21.295 INFO TTTTTTTTTTTTTTT 2013-04-24 09:12:21.489 INFO... (3 Replies)
Discussion started by: shariquehabib
3 Replies

10. Shell Programming and Scripting

Perl:Script to append date and time stamp

Help with Perl script : I have a web.xml file with a line <display-name>some_text_here</display-name> Need to append the current date and time stamp to the string and save the XML file Something like <display-name>some_text_here._01_23_2014_03_56_33</display-name> -->Finally want... (5 Replies)
Discussion started by: gaurav99
5 Replies
ipa-csreplica-manage(1) 					 IPA Manual Pages					   ipa-csreplica-manage(1)

NAME
ipa-csreplica-manage - Manage an IPA CS replica SYNOPSIS
ipa-csreplica-manage [OPTION]... [connect|disconnect|del|list|re-initialize|force-sync] DESCRIPTION
Manages the CA replication agreements of an IPA server. connect [SERVER_A] <SERVER_B> - Adds a new replication agreement between SERVER_A/localhost and SERVER_B disconnect [SERVER_A] <SERVER_B> - Removes a replication agreement between SERVER_A/localhost and SERVER_B del <SERVER> - Removes all replication agreements and data about SERVER list [SERVER] - Lists all the servers or the list of agreements of SERVER re-initialize - Forces a full re-initialization of the IPA CA server retrieving data from the server specified with the --from option force-sync - Immediately flush any data to be replicated from a server specified with the --from option The connect and disconnect options are used to manage the replication topology. When a replica is created it is only connected with the master that created it. The connect option may be used to connect it to other existing replicas. The disconnect option cannot be used to remove the last link of a replica. To remove a replica from the topology use the del option. If a replica is deleted and then re-added within a short time-frame then the 389-ds instance on the master that created it should be restarted before re-installing the replica. The master will have the old service principals cached which will cause replication to fail. OPTIONS
-H HOST, --host=HOST The IPA server to manage. The default is the machine on which the command is run Not honoured by the re-initialize command. -p DM_PASSWORD, --password=DM_PASSWORD The Directory Manager password to use for authentication -v, --verbose Provide additional information -f, --force Ignore some types of errors --from=SERVER The server to pull the data from, used by the re-initialize and force-sync commands. EXAMPLES
List a server's replication agreements. # ipa-csreplica-manage list srv1.example.com srv2.example.com srv3.example.com Re-initialize a replica: # ipa-csreplica-manage re-initialize --from srv2.example.com This will re-initialize the data on the server where you execute the command, retrieving the data from the srv2.example.com replica Add a new replication agreement: # ipa-csreplica-manage connect srv2.example.com srv4.example.com Remove an existing replication agreement: # ipa-csreplica-manage disconnect srv1.example.com srv3.example.com Completely remove a replica: # ipa-csreplica-manage del srv4.example.com Using connect/disconnect you can manage the replication topology. EXIT STATUS
0 if the command was successful 1 if an error occurred IPA
Jul 14 2011 ipa-csreplica-manage(1)
All times are GMT -4. The time now is 01:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy