Last active
April 14, 2025 21:51
-
-
Save tsilvs/a45206996ef77aa8c0ef0fee382d2770 to your computer and use it in GitHub Desktop.
rclone SystemD service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install: | |
# cp [email protected] ~/.config/systemd/user/ && systemctl --user enable --now rclone-mount@$CLOUD_NAME | |
# Where $CLOUD_NAME is a section name from rclone.conf | |
[Unit] | |
Description=RClone mount: %i | |
Documentation=man:rclone(1) | |
After=network.target | |
Wants=network-online.target | |
StartLimitIntervalSec=300 | |
StartLimitBurst=3 | |
[Service] | |
Type=notify | |
#Restart=on-failure | |
#User=%u | |
ExecStartPre=-/bin/fusermount -uz %h/mnt/rclone/%i | |
ExecStartPre=/usr/bin/mkdir -p %h/logs/ | |
ExecStartPre=/usr/bin/touch %h/logs/rclone-%i.log | |
ExecStartPre=/usr/bin/mkdir -p %h/mnt/rclone/%i | |
ExecStart=/usr/bin/rclone mount \ | |
--config %h/.config/rclone/rclone.conf \ | |
--vfs-cache-mode full \ | |
--vfs-cache-max-size 30G \ | |
--vfs-cache-max-age 8760h \ | |
--dir-cache-time 1s \ | |
--poll-interval 30s \ | |
--log-level DEBUG \ | |
--log-file %h/logs/rclone-%i.log \ | |
--umask 022 \ | |
--allow-other \ | |
%i: %h/mnt/rclone/%i | |
ExecStop=/bin/fusermount -uz %h/mnt/rclone/%i | |
[Install] | |
WantedBy=default.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install: | |
# cp [email protected] ~/.config/systemd/user/ && systemctl --user enable --now rclone-sync@$CLOUD_NAME | |
# Where $CLOUD_NAME is a section name from rclone.conf | |
[Unit] | |
Description=RClone Sync: %i | |
Documentation=man:rclone(1) | |
After=network.target | |
Wants=network-online.target | |
[Service] | |
Type=oneshot | |
ExecStartPre=/usr/bin/mkdir -p %h/logs/ | |
ExecStartPre=/usr/bin/touch %h/logs/rclone-sync-%i.log | |
ExecStartPre=/usr/bin/mkdir -p %h/mnt/rclone-sync/%i | |
ExecStart=/usr/bin/rclone bisync %h/mnt/rclone-sync/%i %i: \ | |
--config %h/.config/rclone/rclone.conf \ | |
--resync \ | |
--log-level DEBUG \ | |
--log-file %h/logs/rclone-sync-%i.log | |
[Install] | |
WantedBy=default.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install: | |
# cp [email protected] ~/.config/systemd/user/ && systemctl --user enable --now rclone-sync@$CLOUD_NAME.timer | |
# Where $CLOUD_NAME is a section name from rclone.conf | |
[Unit] | |
Description=RClone Sync Timer for %i (Periodic) | |
[Timer] | |
OnCalendar=*-*-* *:0/1:00 | |
Persistent=true | |
RandomizedDelaySec=300 | |
Unit=rclone-sync@%i.service | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment