OVH Community, your new community space.

FTP Backup Via Cron


Myatu
13-09-2010, 18:09
Look at /usr/share/doc/vzdump/examples/hook-script.pl. Then in a newly created file named /etc/vzdump.conf you add:

Code:
script: /file/path/to/scripts/backup_hook.pl
Obviously with the actual path/filename to the script, and ensure the script has the executable flag set. The script is called by vzdump at several stages, passing the stage as an argument. For example, "backup-end" when it successfully finished creating a backup. Then the environment variables contain more details about, say, the tar-file ($ENV{TARFILE}), where the log file is, etc.

sircolin
13-09-2010, 03:28
Thank you yonatan for the advice this was just a quick fix whilst i been busy on other projects

Myatu thank also for your comments and please both accept my apologizes for the late reply i had had my head shoved inside a bash shell for too long now ;-)

Use the -v option
I should have got the verbose option really thanks for the tip.

I am looking at LFTP now im not a big fan of installing anything on the hostnode if i can get away with it.

By the way, I've noticed you mentioned "/var/lib/vz/backups". Are you using Proxmox? If so, did you know you can use a vzdump hook at several stages?
Yes i was aware of that but i been real busy so i haven't had the time to sit down and get any reading done.

It would be very helpful if you could push my web browser in the right direction so i could read up further on vzdump hooks as it sounds like what i have been looking for.

thank again col

Myatu
22-08-2010, 16:55
Use the -v option for ftp, ie:

Code:
ftp -v -n $SERVER <
and make sure the cron job logs what happens, including errors, ie:

Code:
00 02 * * * /root/mybackupscript.sh > /var/log/mybackups.log 2>&1
This way you get more details rather than the "Interactive mode off", helping you find the cause.

I can also suggest an alternative FTP client: LFTP (See http://lftp.yar.ru/ - or Debian/Ubuntu/CentOS package "lftp") -- it can simplify [ftp] life a little

By the way, I've noticed you mentioned "/var/lib/vz/backups". Are you using Proxmox? If so, did you know you can use a vzdump hook at several stages? I've personally used that to automatically upload a completed backup onto FTP (and check for versions older than X days and remove them).

yonatan
22-08-2010, 16:24
a much more easy way is to use wput
its like wget

http://wput.sourceforge.net/

sircolin
22-08-2010, 16:13
I wonder if someone here could take a look at my FTP backup script.

I have added a cronjob which has run for the first time today but the backup didn't work i did receive an email however which contained
Interactive mode off.
but no files were transferred.

Im gueesing the the cronjob and the permissions of the script are ok due to the email but could any body tell me where i have gone wrong with the script pls.
the files i wish to backup are stored in /var/lib/vz/backups and are all tar files the script also runs from that directory.

here is the script
#!/bin/sh
USERNAME="xxxxxxx.kimsufi.com"
PASSWORD="xxxxxxxxx"
SERVER="ftpback-xxx-103.ovh.net"


# remote server directory to upload backup
BACKUPDIR="/backups"

# login to remote server
ftp -n $SERVER < user $USERNAME $PASSWORD
cd $BACKUPDIR
prompt
mput *
quit
EOF
thanks

Col