ftpbox

Owncloud will not back up certain files, such as those beginning with underscores. Ftpbox is a hack that allows me to back up all files manually, using batch files. A better option is rsync. Osync for bidirectional sync.

Installation

1
2
#apt-get update
#apt-get install lftp

Batch files

ftpbox-download.sh
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
HOST='mysite.net'
USER='ftpbox@mysite.net'
TARGETFOLDER='/home/mbc/ftpbox'
SOURCEFOLDER='/'

lftp -f "
open $USER@$HOST
lcd $SOURCEFOLDER
mirror --verbose --delete --only-newer $SOURCEFOLDER $TARGETFOLDER bye"

ftpbox-upload.sh
1
2
3
4
5
6
7
8
9
10
11
12

#!/bin/bash
HOST='mysite.net'
USER='ftpbox@mysite.net'
TARGETFOLDER='/'
SOURCEFOLDER='/home/mbc/ftpbox'

lftp -f "
open $USER@$HOST
lcd $SOURCEFOLDER
mirror --reverse --delete --verbose --only-newer $SOURCEFOLDER $TARGETFOLDER bye"

put in ~/.profiles for execution on login

for execution at shutdown:

sudo cp ./ftpbox-upload.sh /etc/init.d/
sudo update-rc.d ftpbox-upload.sh start 03 0 6

0 is for shutdown
6 is for reboot
03 puts it in the middle of the scripts run
update-rc.d creates a symlink

Run on login, logout, cron

~/.bash_profile or ~/.bash_login do not exist on Ubuntu

Use ~/.profile for login scripts and append:

~/ftpbox-download.sh

Use ~/.bash_logout for logout scripts

~/ftpbox-upload.sh

crontab -e to edit crontab
add 1 line per command

*/10 * * * * /home/dad/ftpbox-upload.sh

chmod 600 ~/.netrc ;read and write by user only

**~/.netrc **
machine www..net login ftpbox@mysite.net password

Share