WebDAV

From Egbert's Wiki

Introduction

It is possible to mount a WebDAV space on a (headless) server using the davfs2 file system. This mount gives the possibility to save local backup files, made with backup-manager or a WP plugin like BackWPup, to the Stack space.

Installation

Refer to the TransIP website. This describes the procedure to allow a non-root user to mount the WebDAV share.The man pages of davfs give examples of mounting by root too.

Usage

By adding a few lines to the standard backup-manager cronjob, it is easy to copy the created file to external Stack storage:

root@vps:~# cat /etc/cron.daily/backup-manager
#!/bin/sh
# cron script for backup-manager
test -x /usr/sbin/backup-manager || exit 0
/usr/sbin/backup-manager

# mount TransIP Stack storage, copy files, unmount
mount -t davfs https://hejvdb.stackstorage.com/remote.php/webdav/ /media/stack
rsync /var/archives/*.gz /media/stack/archive
umount /media/stack

Backup-manager does not have to upload using the build in methods. By moving the mount line above the execution of backup-manager, it should be possible to use the rsync as upload method and remove the rsync from the cronjob. This is not tested yet.