I want to back up my /data/ folder and exclude some subfolders such as /data/plex/
I also want this backup to maybe use 1G of memory and 20M of upload.
How would I include the 1G of memory and be sure that this script only happens for an hour every 12 hours.
Also, is it /plex/
in my exclude file or is it ./plex
since it's a subfolder of the /data/folder?
crontab -e
0 */12 * * * /usr/bin/flock -n /tmp/upload.lock /data/bin/backup.sh
backup.sh
#!/bin/bash
RCLONE_CONFIG=/opt/rclone/rclone.conf
export RCLONE_CONFIG
if [[ "`pidof -x $(basename $0) -o %PPID`" ]]; then exit; fi
/usr/bin/rclone copy --log-file /opt/rclone/logs/upload.log -v --user-agent rclone --exclude-from /opt/rclone/exclude-file.txt --fast-list --copy-links --bwlimit 20M --config /opt/rclone/rclone.conf /data/ drive:data/
/opt/rclone/exclude-file.txt
/plex/**
/jellyfin/**
/emby/**
/.cache/**
/sonarr/MediaCover/**
/radarr/MediaCover/**
/lidarr/MediaCover/**