I just created a scrip to create and then upload a backup to a ftp server
1: create folder “arhiva” into /home/pi/data
2: add some files named emoncms-backup-whatevertexthere
the scipt will keep the same number of files and just delete the oldest ones
3: apt-get update, then apt-get lftp
4: sudo crontab-e and add a cron line like this:
0 6 * * * /home/pi/backup-ftp.sh >> /home/pi/backup-ftp.log
DATA=`date +%F`
#echo $DATA
echo Start program $DATA
echo arhivam
cd /home/pi/backup/
bash emoncms-export.sh
cd /home/pi/data/arhiva/
#echo rm `head -1 list`
ls -1 -t -r emoncms-backup* > list
echo rm `head -1 list`
rm `head -1 list`
#rm list
echo gata-arhiva
lftp -c "set ftp:list-options -a;
set ssl:verify-certificate false;
open ftp://user:pass@host;
lcd /home/pi/data/arhiva/;
mirror --reverse --delete --use-cache --verbose --allow-chown --allow-suid --no-umask --parallel=2 --exclude-glob .svn"
Edit - formatted code for readability. BT - Moderator