# Device Mountpoint FStype Options Dump Pass#
/dev/sda1 /home/ftp/usb ext4 rw 1 1
background=YES
listen=YES
anonymous_enable=YES
local_enable=YES
write_enable=YES
check_shell=NO
session_support=NO
anon_upload_enable=YES
anon_other_write_enable=YES
anon_mkdir_write_enable=YES
#!/bin/sh
# Setup variables, based on your server info
DEST_PORT={your server port}
DEST_SERVER={your server username}@{your server name}:/{your server targetdir}
# Setup the target dir on the mr3040
SRC_DIR=/home/ftp/usb
# Make sure the file at least exists
touch /tmp/xfer.old
# In the unmounted directory, we created a file called NOT_MOUNTED
if [ -e $SRC_DIR/NOT_MOUNTED ]; then
# If it exists then we need to mount the usb key
echo Warning: backup.sh did not find mounted filesystem
mount $SRC_DIR
elif [ -e /tmp/xfer.now ];then
# If the xfer.now exists, then we're probably still running from a minute ago
echo Warning: backup.sh found /tmp/xfer.now, assuming previous call still running
else
# SRC_DIR mounted, and we're not already running, dump the source file sizes
du -a $SRC_DIR/* | egrep -i "JPG|CR2|MOV" > /tmp/xfer.now
# Has anything changed since last tim we did the transfer?
cmp -s /tmp/xfer.old /tmp/xfer.now
if [ $? -ne 0 ];then
# Yes, something changed. For debug date stamp when we started.
date > /tmp/xfer.done
# They do the transfer, use --size-only to speed up the checking
/usr/bin/rsync --size-only -e '/usr/bin/ssh -i /root/.ssh/dropbear -p $DEST_PORT' -av $SRC_DIR/ $DEST_SERVER/ >> /tmp/xfer.done
if [ $? -eq 0 ];then
# If the rsync didn't fail, then move the current file sizes to the old list
mv /tmp/xfer.now /tmp/xfer.old
fi
fi
# Whatever we did, remove the xfer.now file, so that we can re-run next time
rm -f /tmp/xfer.now
fi
* * * * * /root/backup.sh