Skip to content

Instantly share code, notes, and snippets.

@Finkregh
Created April 27, 2023 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Finkregh/7c16a70178318676f7e9f96bbf4061d2 to your computer and use it in GitHub Desktop.
Save Finkregh/7c16a70178318676f7e9f96bbf4061d2 to your computer and use it in GitHub Desktop.
rclone systemd timer
[Unit]
Description=rclone %i
[Service]
Nice=19
IOSchedulingClass=idle
#KillSignal=SIGINT
EnvironmentFile=/usr/local/etc/rclone-spawn/%i.env
ExecStart=/usr/local/bin/rclone-spawn.sh %i
[Install]
WantedBy=multi-user.target
[Unit]
Description=Weekly rclone %i
[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true
[Install]
WantedBy=multi-user.target
#!/usr/bin/bash
set -euo pipefail
if [[ -f /usr/local/etc/rclone/${1}.filter ]]; then
RCLONE_FILTER="--filter-from /usr/local/etc/rclone/${1}.filter"
fi
${RCLONE_PRE_COMMAND:-}
rclone --config /usr/local/etc/rclone/${1}.conf -v --stats 60s ${RCLONE_FILTER:-} ${RCLONE_SUBCOMMAND}
${RCLONE_POST_COMMAND:-}
[remote]
account = somethingsomething
key = secretsecret
type = b2
folder = /
bucket = bucketname
chunk_size = 96M
fast_list = false
RCLONE_SUBCOMMAND="--dry-run sync /source remote:bucketname/"
# run some command/s before rclone
RCLONE_PRE_COMMAND="echo something something"
# run some command/s after rclone
RCLONE_POST_COMMAND="echo do some notification?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment