User Tools

Site Tools


howtos:automatic_backup_via_ftp_with_fsniper

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

howtos:automatic_backup_via_ftp_with_fsniper [d/m/Y H:i] (current)
Line 1: Line 1:
 +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:
 +<code>
 +sudo apt-get install fsniper lftp
 +</code>
 +
 +Script:
 +<file>
 +#!/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
 +
 +</file>
 +
 +fsniper configuration file (~/.config/fsniper/config) :
 +<file>
 +delay_time = 60 
 +delay_repeats = 0
 +
 +watch {
 +  /home/tdd/FtpSync {
 +    recurse = true
 +    * {
 +      handler = /home/tdd/ftpsync.sh
 +    }
 +  }
 +}
 +</file>
 +
 +Getting going:
 +First time running to get a feeling on how it works out, e.g. fixing any errors
 +<code>
 +fsniper --log-to-stdout
 +</code>
 +
 +When things work:
 +<code>
 +fsniper --daemon
 +</code>
 +
 +----
 +----
 +Source: http://www.seiichiro0185.org/doku.php/blog:automatic_backup_to_ftp_with_fsniper_and_lftp
howtos/automatic_backup_via_ftp_with_fsniper.txt · Last modified: d/m/Y H:i (external edit)