cancel
Showing results for 
Search instead for 
Did you mean: 

file move

tempsample
Frequent Advisor

file move

for HOST in `cat /tmp/newhostdetails.txt`    -- #since i am running from other OS ,I used evil cat.
do
echo $HOST
echo "#########"
ssh -q -o ConnectTimeout=60 user@$HOST ls -l /tmp/*.02.19.2014.output.tar.gz
if [ $? -ne 0 ]; then
echo "host $HOST not responding"
STAT="*file not available*"
else
echo "host $HOST responding"
STAT="*file available*"
scp -p user@$i:/tmp/*.02.19.2014.output.tar.gz /tmp/deout
if [ $? -ne 0 ]; then
echo "tar output not colletced"
TARSTAT="*not collected*"
else
echo "tar output collected"
TARSTAT="collected"
fi
echo  "|${HOST} ${STAT} ${TARSTAT}|" >> /tmp/deoliteoutput.txt
fi
done

 

------------------>

 

 

I am using the above script to check *.02.19.2014.output.tar.gz.

 

if file name "*.02.19.2014.output.tar.gz" exists it has to scp the file to /tmp/deout.

 

but i am getting the error at scp -p user@$i:/tmp/*.02.19.2014.output.tar.gz /tmp/deout

 

$i is not read at line scp -p user@$i:/tmp/*.02.19.2014.output.tar.gz /tmp/deout.

 

 

P.S. This thread has been moved from HP-UX>Languages and Scripting to LInux > sysadmin. -HP Forum Moderator

2 REPLIES
RJHall
Frequent Advisor

Re: file move

Where are you setting 'i' ?

Patrick Wallek
Honored Contributor

Re: file move

You say "for HOST in ..." but then use $i in your SCP / SSH commands.  You should probably use $HOST