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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to compress .zlib file wrapster UNIX for Advanced & Expert Users 1 05-04-2008 11:52 PM
unix script to takes the old data from a TXT file and compress them into new file vpandey Shell Programming and Scripting 2 03-05-2008 08:10 AM
compress more than one file prasee UNIX for Advanced & Expert Users 2 09-08-2007 06:15 AM
compress a file in unix rujupriya UNIX for Dummies Questions & Answers 5 05-24-2006 05:05 AM
[help] Cant compress file endeavour1985 UNIX for Dummies Questions & Answers 8 01-17-2005 09:37 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-21-2006
Registered User
 

Join Date: Nov 2006
Posts: 5
Compress a file before ftp

Hi,

I have a script that ftp's to over 100 deifferent servers in turn, gets a specific file, renames it and drops it onto a local backup server. The files vary in size from 4mb to 150mb. I am within a secure intranet to security with ftp is not an issue. I want to auto compress the file before I ftp it over the network, either as a seperate script or as a comand conatained within my original.

Can anyone help?

the current script is as follows:
Code:
hostFile=/data01/global_backup/scripts/GLOBAL_hostFile.txt
while read ip sd
do
echo "connecting to $sd on $ip"
ftp -dv $ip <<EOF
get /global/prd/cycle/export/full_export.dmp /data01/global_backup/files/monday/$sd.full_export.dmp
bye
EOF
if [ $? -ne 0 ]; then
echo "Had a problem connecting to $sd on $ip"
else
echo "Connected to $sd on $ip"
fi
done < ${hostFile}
Reply With Quote
Forum Sponsor
  #2  
Old 11-21-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
If your system supports remsh, try something like this
Code:
hostFile=/data01/global_backup/scripts/GLOBAL_hostFile.txt
while read ip sd
do
  echo "connecting to $sd on $ip"
remsh "$sd" compress /global/prd/cycle/export/full_export.dmp 
if [[ $? -ne 0 ]] ; then
   echo "error compressing file on $sd"
fi 
ftp -dv $ip <<EOF
bin
get /global/prd/cycle/export/full_export.dmp /data01/global_backup/files/monday/$sd.full_export.dmp
bye
EOF
if [ $? -ne 0 ]; then
echo "Had a problem connecting to $sd on $ip"
else
echo "Connected to $sd on $ip"
fi
done < ${hostFile}
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 01:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0