How to copy to server & delete locally?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to copy to server & delete locally?
# 1  
Old 06-28-2007
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  
Old 06-28-2007
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  
Old 06-28-2007
Thanks navkanwal, this should work if only I make sure the script completes running before 0h00.
# 4  
Old 06-28-2007
Hi

In that case u may ftp the file

proj_bk*.tar.gz


U can exclude the date parameter from the file...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SFTP Shell Script Get & Delete && Upload & Delete

Hi All, Do you have any sample script, - auto get file from SFTP remote server and delete file in remove server after downloaded. - only download specify filename - auto upload file from local to SFTP remote server and delete local folder file after uploaded - only upload specify filename ... (3 Replies)
Discussion started by: weesiong
3 Replies

2. Ubuntu

Load Balancing - LB Server & BackEnd1 & BackEnd2

Hello, What I wish to succeed is to setup loadbalancing between two dedicated servers. Here is my case: ======================================================================================================= LB IP (Just an IP address): Provided by hosting company (11.22.33.44) Hosting company... (1 Reply)
Discussion started by: baris35
1 Replies

3. Shell Programming and Scripting

Need Script to ZIP/SAVE & then DELETE Log file & send a mail conformation for any error

ENVIROMENT Linux: RHEL 6.4 Log Path: /usr/iplanet/servers/https-company/logs Log Format: user.log.03-15-2015 I have log4j log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I need a script that will run daily that... (1 Reply)
Discussion started by: admin_job_admin
1 Replies

4. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

5. Shell Programming and Scripting

Editing a file on remote server using shell script locally

Hi Scott, My previous post was not for any school or college projects. I am currently working with a IT company (Cannot provide more details than this). I am trying to implement the below script in my day-to-day work, Apologies for the confusion in previous post :). My question remains same... (4 Replies)
Discussion started by: Nishant Ladiwal
4 Replies

6. Shell Programming and Scripting

Editing a file on remote server using shell script locally

Hi All, I have below requirements for my project: 1. Building a shell script which connects to a remote server 2. running script on local machine as user 'A' 3. connecting to server using user 'B' with password 4. login with a powerbroker role 'P' (asks for same password as 'B') on that... (1 Reply)
Discussion started by: Nishant Ladiwal
1 Replies

7. Red Hat

Need Script to ZIP/SAVE & then DELETE Log file & DELETE ZIPS older than 12 months

ENVIROMENT Linux: Fedora Core release 1 (Yarrow) iPlanet: iPlanet-WebServer-Enterprise/6.0SP1 Log Path: /usr/iplanet/servers/https-company/logs I have iPlanet log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I... (7 Replies)
Discussion started by: zachs
7 Replies

8. UNIX for Advanced & Expert Users

Using remote rsync, but copy locally?

I'm looking to use rsync to compare remote files and to copy the diff to a local directory, rather than transfer over the net. The net connection is not fast enough to transfer these files (~1.8TB) and I'd like to sneakernet them instead. Possible? (4 Replies)
Discussion started by: dfbills
4 Replies

9. Shell Programming and Scripting

How do I search first&second string & copy all content between them to other file?

Hi All, How do I search first string & second string and copy all content between them from one file to another file? Please help me.. Thanks In Advance. Regards, Pankaj (12 Replies)
Discussion started by: pankajp
12 Replies

10. Solaris

Using RSYNC to copy files locally

Has anyone ever used rsync to copy files locally on one server? (in this case from one SAN volume to another). I am familiar with using rsync to copy files between servers, but not locally, I would usually use cp or or tar or something. Is rsync slower? Does it use additional overhead of the... (4 Replies)
Discussion started by: BG_JrAdmin
4 Replies
Login or Register to Ask a Question