Created
March 19, 2019 22:54
-
-
Save werrpy/569dcb8d050825c153ef2c170d06314a to your computer and use it in GitHub Desktop.
gdrive plex mount cron
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
*/5 * * * * /home/USERNAME/bin/gdrive-mount-media.sh |
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
#!/bin/bash | |
function ppgrep() { pgrep "$@" | xargs --no-run-if-empty ps fp; } | |
function mount_media() { /home/USERNAME/bin/rclone --config /home/USERNAME/gdrive/config/rclone.conf mount media-remote-secret: /home/USERNAME/mount-media --read-only --dir-cache-time 48h --vfs-read-chunk-size 32M --vfs-read-chunk-size-limit 2G --tpslimit 5 --tpslimit-burst 5 > /dev/null 2>&1 & } | |
function umount_media() { fusermount -u /home/USERNAME/mount-media > /dev/null 2>&1; } | |
if [[ ! $(ppgrep rclone | grep -e "mount media-remote-secret") ]]; then umount_media; mount_media; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
restarts every 5 minutes if not running