Skip to content

Instantly share code, notes, and snippets.

@werrpy
Created March 19, 2019 22:54
Show Gist options
  • Save werrpy/569dcb8d050825c153ef2c170d06314a to your computer and use it in GitHub Desktop.
Save werrpy/569dcb8d050825c153ef2c170d06314a to your computer and use it in GitHub Desktop.
gdrive plex mount cron
*/5 * * * * /home/USERNAME/bin/gdrive-mount-media.sh
#!/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
@werrpy
Copy link
Author

werrpy commented Mar 19, 2019

restarts every 5 minutes if not running

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