- Used on
Kubuntu 16.04 - Used with Cryptomator
- Cryptomator must be decrypted prior to using any of the scripts.
Dependencies
rsyncdavfs2Cryptomator
Todo
- watch script with sync
| #!/bin/bash | |
| WDAV="WEB_DAV_URL" | |
| # sudo required | |
| sudo mount -t davfs $WDAV "/home/USERNAME/DEST" -o uid=$USERNAME |
| #!/bin/bash | |
| #Make sure to set variables! | |
| USR="USERNAME" | |
| ENV=$(hostname | cut -d"." -f1 |tr "[:upper:]" "[:lower:]") | |
| SRC_DIR="Documents" | |
| SRC="/home/${USR}/${SRC_DIR}" | |
| BASE=$(basename $SRC) | |
| DIR="PATH" # ~/Crypt/Backup => Crypt/Backup | |
| DEST="/home/${USR}/${DIR}" | |
| WDAV="URI" # http://localhost:42427/dlskfjsldkjf/Crypt/ | |
| EXC="--exclude .git/ --exclude node_modules/ --exclude bower_components/ --exclude .DS_Store/ --exclude .DS_Store" #Excludes | |
| if [ -d $DEST ] | |
| then | |
| echo "Clean Mount" | |
| sudo umount -t davfs $DEST | |
| fi | |
| echo "Mount - sudo required, press return for username and password" | |
| sudo mount -t davfs $WDAV $DEST -o uid=$USR | |
| echo "Syncing" | |
| /usr/bin/rsync -rtv --ignore-existing --del --delete-excluded $EXC "${SRC}/" "${DEST}/${ENV}-${BASE}/" | |
| echo "Sync Finished" | |
| #!/bin/bash | |
| SRC="/home/USERNAME/DEST" | |
| #sudo required | |
| sudo umount -t davfs /home/USERNAME/Crypt |
Just wanted to let you know this script was really helpful to automating my backup to a Cryptomator virtual drive. Thank you for posting it.