Advertisement
Guest User

Untitled

a guest
Apr 19th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 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/wut/scripts/mount.cron >/dev/null 2>&1
  5. # Make script executable with: chmod a+x /home/wut/scripts/mount.cron
  6.  
  7. logfile="/home/wut/scripts/logs/mount-tv.cron.log"
  8.  
  9. if pidof -o %PPID -x "mount-tv.cron"; then
  10. echo "$(date "+%d.%m.%Y %T") EXIT: mount-tv.cron already running."
  11. exit 1
  12. fi
  13.  
  14. if [[ -f "/home/wut/acd-tv/mountcheck" ]]; then
  15. echo "$(date "+%d.%m.%Y %T") INFO: Check successful, acd-tv 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 /home/wut/acd-tv | 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. --config /home/wut/.rclone.conf \
  31. t-acd:/ /home/wut/acd-tv/ &
  32.  
  33. if [[ -f "/home/wut/acd-tv/mountcheck" ]]; then
  34. echo "$(date "+%d.%m.%Y %T") INFO: Remount successful." | tee -a "$logfile"
  35. else
  36. echo "$(date "+%d.%m.%Y %T") CRITICAL: Remount failed." | tee -a "$logfile"
  37. fi
  38. fi
  39. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement