Prereq:
* A ftp account
* Create a local directory you want to synchronize/backup
* Create a directory on the ftp server you want to upload the content to
Tools:
sudo apt-get install fsniper lftp
Script:
#!/bin/bash
trap "rm /tmp/ftpsync.lock" SIGINT SIGTERM
if [ -e /tmp/ftpsync.lock ]
then
echo "ftpsync already running.."
exit 2
else
touch /tmp/ftpsync.lock
lftp domingo.dk -u ftpuser,ftpuserpass << EOF
lcd /home/tdd/FtpSync
cd FtpSync
mirror -R -e
quit
EOF
rm /tmp/ftpsync.lock
exit 0
fi
fsniper configuration file (~/.config/fsniper/config) :
delay_time = 60
delay_repeats = 0
watch {
/home/tdd/FtpSync {
recurse = true
* {
handler = /home/tdd/ftpsync.sh
}
}
}
Getting going:
First time running to get a feeling on how it works out, e.g. fixing any errors
fsniper --log-to-stdout
When things work:
fsniper --daemon
----
----
Source: http://www.seiichiro0185.org/doku.php/blog:automatic_backup_to_ftp_with_fsniper_and_lftp