Hi,

I have a script that I what the last part of the element of an array? So I can restart 
the script with the same element. Help:

#!/bin/perl
use strict;
 
# Need IP of current procees so I can re-start it.
# How it is returned:
#     root  6762  1355  0   Oct 05 pts/2    0:00 /bin/perl -w ./script.pl 
211.211.111.111
#                                                                                      
                                                                    
my @ip = `ps -ef|grep script.pl|grep -v grep`;
  
# Grab PID of current procees so I can kill it.
# How it is returned:
#6762
#
my @script= `pgrep script.pl`;
 
foreach (@nab) {
print("Killing $_\n");
}
 
foreach (@ip){
print "/opt/script.pl $_\n";                                                           
                                                          
}

###############


whats displayed:

bash-2.03# ./ks.pl                                                                     
                                                             
Killing 6762
 
/opt/script.pl     root  6762  1355  0   Oct 08 pts/2    0:00 /bin/perl -w ./script.pl 
211.211.111.111
 
bash-2.03# 

I would lilke it to:
bash-2.03# ./ks.pl                                                                     
                                                             
Killing 6762
 
/opt/script.pl 211.211.111.111 &
 
bash-2.03# 


Please advise...And of course thanks
Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to