Skip to content

Instantly share code, notes, and snippets.

@hthighway
Last active March 16, 2021 20:30
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hthighway/ba4e19f314b347670acb3e15597300a4 to your computer and use it in GitHub Desktop.
Save hthighway/ba4e19f314b347670acb3e15597300a4 to your computer and use it in GitHub Desktop.
SYSTEMD files for plexdrive. Ceates a plexdrive mount and then a UnionFS of local and remote content (SEE updated version here: https://github.com/hthighway/scripts/tree/master/plexdrive )
[Unit]
Description=Plexdrive
AssertPathIsDirectory=/mnt/plexdrive
After=network-online.target
[Service]
Type=simple
#
# uid & gid values are for the user that you want to run plexdrive, $id will give you the values for the logged in user
#
ExecStart=/opt/plexdrive/plexdrive -c /home/user/.plexdrive -v 2 -o allow_other --uid=1000 --gid=1000 /mnt/plexdrive
ExecStop=/bin/fusermount -uz /mnt/plexdrive
Restart=on-abort
RestartSec=30
StartLimitInterval=200
StartLimitBurst=5
[Install]
WantedBy=default.target
#
# To monitor the PlexDrive activity use: sudo journalctl -f -u plexdrive
#
[Unit]
Description=UnionFS Mount (plexdrive)
AssertPathIsDirectory=/mnt/media
After=plexdrive.service
Requires=plexdrive.service
PartOf=plexdrive.service
[Service]
Type=forking
User=user
Group=user
ExecStart=/bin/sh /home/user/scripts/unionfs.sh
ExecStop=/bin/fusermount -uz /mnt/media
Restart=on-abort
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
[Install]
WantedBy=default.target
#!/bin/sh
unionfs-fuse \
-o cow,allow_other,large_read,statfs_omit_ro,atomic_o_trunc,\
auto_cache,big_writes,default_permissions,splice_move,splice_read,nonempty \
-o uid=1000 -o gid=1000 /mnt/local=RW:/mnt/plexdrive/remote_media=RO /mnt/media
@phampyk
Copy link

phampyk commented Mar 16, 2021

plexdrive.service is missing the mount

ExecStart=/opt/plexdrive/plexdrive mount -c /home/user/.plexdrive -v 2 -o allow_other --uid=1000 --gid=1000 /mnt/plexdrive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment