Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #!/bin/bash
  2. # Change paths for mount and log file & create mountcheck file.
  3. # Add script to crontab by typing crontab -e and pasting the line below (without # in front )
  4. # * * * * * /home/scripts/mount-m.cron >/dev/null 2>&1
  5. # Make script executable with: chmod a+x /home/scripts/mount-m.cron
  6.  
  7. logfile="/home25/mckentin/scripts/logs/mount-m.cron.log"
  8.  
  9. if pidof -o %PPID -x "mount-m.cron"; then
  10. echo "$(date "+%d.%m.%Y %T") EXIT: mount-m.cron already running."
  11. exit 1
  12. fi
  13.  
  14. if [[ -f "/home25/mckentin/acd-movies/mountcheck" ]]; then
  15. echo "$(date "+%d.%m.%Y %T") INFO: Check successful, acd-movies mounted." | tee -a "$logfile"
  16. exit
  17. else
  18. echo "$(date "+%d.%m.%Y %T") ERROR: Drive not mounted, remount in progress." | tee -a "$logfile"
  19. # Unmount before remounting
  20. fusermount -uz /home25/mckentin/acd-movies | tee -a "$logfile"
  21. rclone mount \
  22. --read-only \
  23. --allow-non-empty \
  24. --allow-other \
  25. --max-read-ahead 200M \
  26. --acd-templink-threshold 0 \
  27. --checkers 16 \
  28. --quiet \
  29. --stats 0 \
  30. m-acd:/ /home25/mckentin/acd-movies/&
  31.  
  32. if [[ -f "/home25/mckentin/acd-movies/mountcheck" ]]; then
  33. echo "$(date "+%d.%m.%Y %T") INFO: Remount successful." | tee -a "$logfile"
  34. else
  35. echo "$(date "+%d.%m.%Y %T") CRITICAL: Remount failed." | tee -a "$logfile"
  36. fi
  37. fi
  38. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement