The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
OfflineIMAP makes messages and attachments available locally iBot UNIX and Linux RSS News 0 05-06-2008 04:40 AM
Delete and copy file(s) slowly(!?) trantuananh24hg SUN Solaris 5 02-21-2008 11:00 PM
Unzip, copy, and delete loop spyne Shell Programming and Scripting 3 03-07-2007 01:30 PM
Command for copy a file from one server to another server sarwan High Level Programming 2 11-13-2005 11:17 AM
Telnet and file Copy/Delete Problem biglemon UNIX for Dummies Questions & Answers 17 08-08-2002 08:29 AM

Closed Thread
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
  #1 (permalink)  
Old 06-28-2007
mokgonec mokgonec is offline
Registered User
  
 

Join Date: Jun 2007
Location: Pietermaritzburg, KZN, South Africa
Posts: 5
Question How to copy to server & delete locally?

Hi,
I've got a cronjob running daily creating backup files. How can I send that created file to a remote server & then delete it on my workstation to save space? The filename format is as follows: proj_bk_20070624_15h30, proj_bk_20070625_15h30, etc

tar cvf - /project | gzip -c > proj_bk_$(date '+20%y%m%d_%Hh%M').tar.gz
ftp remote_server << EOT
binary
put ?????.tar.gz (How do I put the latest created pro_bk file onto the remote server?)
quit
EOT
rm ?????.tar.gz (How do I delete the sent file locally?)
  #2 (permalink)  
Old 06-28-2007
navkanwal navkanwal is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 4
This Would Help Hopefully

If you are moving the file on daily basis then only 1 file with "proj_bk*" is present on the server, incorporate the following changes in the ftp part.

prompt
mput proj_bk_$(date '+20%y%m%d')_*.tar.gz


After end of FTP just remove the file
rm proj_bk_$(date '+20%y%m%d')_*.tar.gz

Hope this helps....
  #3 (permalink)  
Old 06-28-2007
mokgonec mokgonec is offline
Registered User
  
 

Join Date: Jun 2007
Location: Pietermaritzburg, KZN, South Africa
Posts: 5
Thanks navkanwal, this should work if only I make sure the script completes running before 0h00.
  #4 (permalink)  
Old 06-28-2007
navkanwal navkanwal is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 4
Hi

In that case u may ftp the file

proj_bk*.tar.gz


U can exclude the date parameter from the file...
Closed Thread

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 07:05 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