Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Change paths for mount and log file & create mountcheck file.
- # Add script to crontab by typing crontab -e and pasting the line below (without # in front )
- # * * * * * /home/wut/scripts/mount.cron >/dev/null 2>&1
- # Make script executable with: chmod a+x /home/wut/scripts/mount-tv-4k.cron
- logfile="/home/wut/scripts/logs/mount-tv-4k.cron.log"
- if pidof -o %PPID -x "mount-tv-4k.cron"; then
- echo "$(date "+%d.%m.%Y %T") EXIT: mount-tv-4k.cron already running."
- exit 1
- fi
- if [[ -f "/home/wut/acd-tv-4k/mountcheck" ]]; then
- echo "$(date "+%d.%m.%Y %T") INFO: Check successful, acd-tv-4k mounted." | tee -a "$logfile"
- exit
- else
- echo "$(date "+%d.%m.%Y %T") ERROR: Drive not mounted, remount in progress." | tee -a "$logfile"
- # Unmount before remounting
- fusermount -uz /home/wut/acd-tv-4k | tee -a "$logfile"
- rclone mount \
- --read-only \
- --allow-non-empty \
- --allow-other \
- --max-read-ahead 200M \
- --acd-templink-threshold 0 \
- --checkers 16 \
- --quiet \
- --stats 0 \
- --config /home/wut/.rclone.conf \
- tv-4k-acd:/ /home/wut/acd-tv-4k/&
- if [[ -f "/home/wut/acd-tv-4k/mountcheck" ]]; then
- echo "$(date "+%d.%m.%Y %T") INFO: Remount successful." | tee -a "$logfile"
- else
- echo "$(date "+%d.%m.%Y %T") CRITICAL: Remount failed." | tee -a "$logfile"
- fi
- fi
- exit
Add Comment
Please, Sign In to add comment