LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 01-31-2004, 07:46 AM   #1
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,608

Rep: Reputation: 45
howto delete files via ftp from cron job ?


hi

I use this command from cron job

15 4 * * * root tar Pcj /usr/local/httpd | ncftpput -c -u <your_username_on_remote_host> -p <your_pass_on_remote_host> <remote_host> <directory_on_remote_host>/save-`date +%Y.%m.%d-%H%M`.tar.bz2

to save daily via ftp the whole Web server data

it's working well. but now I have
a lot backup files !

how to use this and delete at the same time all old ones backup files ?

kind regards
cccc
 
Old 01-31-2004, 10:19 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
I'm using the find command to delete the backup files which have a modification time ( mtime ) greater than 90 days. Modification time in this case is when the file is created.
You may be able to change this to meet your needs.


#!/bin/bash
filename=`date '+%m%d%y'`
tar -cvzf /mnt/backup/${filename}.tar.gz /home
#Delete old files with the following command
find /mnt/backup -type f -name '*.gz' -mtime +90 -exec rm {} \;
 
Old 01-31-2004, 06:49 PM   #3
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,608

Original Poster
Rep: Reputation: 45
thanks,

I will try this...

kind regards
cccc
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete mails thru cron job massoo Linux - General 0 01-12-2005 02:19 AM
cron job to delete files based on attributes alpha21 Linux - General 3 11-09-2004 12:06 PM
cron job to send file via ftp every 1 hour mcalizo Linux - Newbie 1 07-14-2004 03:50 AM
Howto run a job on a fixed time with cron? Schmurff Linux - Newbie 1 04-02-2004 03:31 AM
Can I make a Cron job to synch/transfer a file from a folder to another FTP?... read efishta Linux - General 6 07-19-2003 10:03 PM


All times are GMT -5. The time now is 05:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration