The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
gzcat into awk and then change FILENAME and process new FILENAME timj123 Shell Programming and Scripting 6 06-23-2008 08:45 AM
Possible to track FTP user last login? Last and Finger don't track them. LordJezo UNIX for Dummies Questions & Answers 1 11-08-2007 01:21 PM
how to read double consecutive space in filename for bash shell james_falco UNIX for Dummies Questions & Answers 1 07-17-2007 05:32 PM
How to send filename as variable in a shell script gthokala9 Shell Programming and Scripting 6 06-27-2006 02:23 PM
sed / shell - how to use $filename eadie Shell Programming and Scripting 5 06-28-2004 11:10 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-17-2009
sdosanjh sdosanjh is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 30
Post How to keep track of filename in different shell

Guys I am trying to install the pkg using the follwoing script.
Trying to run the script from one machine to other machines with the follwoing code.

Now my problem is, when I use scp command on the remote machine, how do i keep track of filename in some variable or that sort of thing.

Below is the sample code.

for GETHOST in `cat $FILENAME`
do
echo "\n Logging onto $GETHOST"
ssh $GETHOST <<EOT
#Getting the machine info for Sparc / AMD machine
TYPE=`uname -a | awk '{print $6}'`
if [ $TYPE != sparc ];
then
scp beast:$AMD_DIR/*.pkg.tar.gz $GETHOST:/home/somename/pkg/
if [ $? = 0 ];
then
echo " Copied the file(s) Successfully on $GETHOST from beast"
else
echo " File(s) not copied on $GETHOST from beast"
exit 2
fi

[Here I have to keep track of all the recent files that have been scp'ed]or suggest any other alternative or any other condition please]
else
scp beast:SPARC_DIR/*.pkg.tar.gz $GETHOST:/home/somenam/pkg/
if [ $? = 0 ];
then
echo " Copied the file(s) Successfully on $GETHOST from beast"
else
echo " File(s) not copied on $GETHOST from beast"
exit 2

[SAME LIKE ABOVE - Here I have to keep track of all the recent files that have been scp'ed]or suggest any other alternative or any other condition please]
fi
fi
# Better to check once again if scp is successfull

# End of here document
EOT
# End of main for loop
done
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0