[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: non-interactive ftp



At 06:57 PM 11/27/2005 +0100, Christian wrote:
>tar cvf - /home | ncftpput -u operator -c server /backups/monday.tar
>
>so i can backup direct to my backup space without saving it to the local 
>disk (which is a good thing, as content grows...). but this way i also 
>have to rotate the backups on the backup space. only ftp is allowed on the 
>backup server and ncftp* does not allow me to send non-RAW ftp command (or 

Another clever thing u can do is use a fifo.  That way u can use the .netrc
to do all the work and not worry about having to pipe on the command line.
I used zip here because it makes it easier to retrieve a single file out of
the archive.  U don't have to gunzip and untar the entire archive.  Both
programs will exit when all the fifo data is used up.

mkfifo ./backupfifo.zip

#!/usr/bin/bash
zip -r backupfifo.zip /home &
ftp --whatever_commandline_options backupserver
exit


# .netrc
macdef rotate-daily
         verbose
         prompt
         cd /backup/daily.2
         mdelete *
         cd /backup
         rename daily.1 daily.2
         rename daily.0 daily.1
         mkdir daily.0
         put backupfifo.zip daily.0/thisbackup.zip
         bye


--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede malis"

00000100



Reply to: