Advertisement
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/scripts/mount-m.cron >/dev/null 2>&1
- # Make script executable with: chmod a+x /home/scripts/mount-m.cron
- logfile="/home25/mckentin/scripts/logs/mount-m.cron.log"
- if pidof -o %PPID -x "mount-m.cron"; then
- echo "$(date "+%d.%m.%Y %T") EXIT: mount-m.cron already running."
- exit 1
- fi
- if [[ -f "/home25/mckentin/acd-movies/mountcheck" ]]; then
- echo "$(date "+%d.%m.%Y %T") INFO: Check successful, acd-movies 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 /home25/mckentin/acd-movies | 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 \
- m-acd:/ /home25/mckentin/acd-movies/&
- if [[ -f "/home25/mckentin/acd-movies/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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement