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
thanks dude...code looks good...but my issue is.... after scp i want to run the pkginstall commands with each filename i scp'ed ... since i am in different shell. isn't it difficult to track the filename of AMD / SPARC directories???? so any alternative to get the file name scp'ed and then use it for pkginstall command...
Thanks john.... it was skipped from my eyes....yeah we can take from LOGFILE.....
Cheers and thanks for the help. will come again on this forum if stuck with some issue.