Skip to content

Instantly share code, notes, and snippets.

@mattbailey
Created May 1, 2020 00:03
Show Gist options
  • Save mattbailey/59a9ec2a31fead1c27d8e513eb6cf463 to your computer and use it in GitHub Desktop.
Save mattbailey/59a9ec2a31fead1c27d8e513eb6cf463 to your computer and use it in GitHub Desktop.
/etc/systemd/system/gdrive.service
[Unit]
Description=%p
After=network-online.target docker.service
Requires=docker.service
[Service]
Restart=always
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/mkdir /gdrive
ExecStartPre=-/usr/bin/docker rm -f %p
ExecStartPre=-/usr/bin/docker pull rclone/rclone:latest
ExecStart=/usr/bin/docker run --rm \
--name=%p \
--device /dev/fuse:/dev/fuse \
-v /tmp/gdrive/cache:/cache \
-v /tmp/gdrive/upload:/upload \
-v /gdrive:/gdrive:shared \
-v /etc/gdrive:/root/.config/rclone \
--cap-add=MKNOD \
--cap-add=SYS_ADMIN \
--security-opt='apparmor:unconfined' \
rclone/rclone:latest rclone mount \
--log-level INFO \
--allow-non-empty \
--allow-other \
--no-modtime \
--checkers=4 \
--vfs-cache-mode=writes \
--cache-db-purge \
--cache-dir=/cache \
--cache-db-path=/cache \
--cache-db-wait-time=1s \
--cache-chunk-path=/cache \
--cache-chunk-size=64M \
--cache-chunk-total-size=80G \
--cache-chunk-clean-interval=1m \
--cache-info-age=12h \
--cache-read-retries=10 \
--cache-workers=8 \
--cache-tmp-wait-time=15m \
--cache-tmp-upload-path=/upload \
--drive-use-created-date \
--drive-use-trash=false \
drive-cache: /gdrive
ExecStop=/usr/bin/docker stop %p
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment