1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2025-04-19 09:10:00 -05:00
random/OneDriveBk.sh
2025-02-13 23:43:51 -06:00

41 lines
1.8 KiB
Bash

#!/usr/bin/env bash
# For backing up files with OneDrive, from my server.
# Assumes that the backup target is set up as encrypted-onedrive in rclone.
# I usually run it once a week by a cronjob.
# force script to run as specific user
if [ "$(id -u)" -eq 0 ]; then
exec sudo -H -u sintan $0 "$@"
fi
# Exit the whole script when ctrl+c is pressed
set -e
# Run only one instance of this script at one time
[ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/onedrivebk.lock" "$0" "$@" || :
# List of backups
rclone -v --fast-list --size-only --links --bwlimit 4M sync "/home/sintan/Pictures" encrypted-onedrive:"Pictures"
rclone -v --fast-list --size-only --links --bwlimit 4M sync "/home/sintan/Videos" encrypted-onedrive:"Videos"
rclone -v --fast-list --size-only --links --bwlimit 4M sync "/home/sintan/Academics" encrypted-onedrive:"Academics"
rclone -v --fast-list --size-only --links --bwlimit 4M sync "/home/sintan/Zotero" encrypted-onedrive:"Zotero"
rclone -v --fast-list --size-only --links --bwlimit 4M sync "/mnt/storage/Music" encrypted-onedrive:"Music"
rclone -v --fast-list --size-only --links --bwlimit 4M sync --exclude="**/.stversions/**" --exclude="/CalibreLibrary/**"\
"/mnt/storage/Documents" encrypted-onedrive:"Documents"
rclone -v --fast-list --size-only --links --exclude="**/menus/**" --exclude="**/unity3d/**"\
--exclude="**/libreoffice/**" --ignore-errors --bwlimit 4M sync "/mnt/storage/dotfiles" encrypted-onedrive:"dotfiles"
rclone -v --fast-list --size-only --links --bwlimit 4M --exclude="**/.stfolders/**"\
--exclude="**/.trashed**" --delete-excluded sync "/home/sintan/TempStorage/DCIM" encrypted-onedrive:"DCIM"
rclone -v --fast-list --size-only --links --bwlimit 4M --exclude="*-config/**" sync "/mnt/storage/Programs"\
encrypted-onedrive:"Programs"