Advertisement
Guest User

Untitled

a guest
Apr 19th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 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/fuse-mount.cron >/dev/null 2>&1
  5. # Make script executable with: chmod a+x /home/scripts/fuse-mount.cron
  6.  
  7. logfile="/home/wut/scripts/logs/fuse-mount.cron.log"
  8.  
  9. if pidof -o %PPID -x "fuse-mount.cron"; then
  10. echo "$(date "+%d.%m.%Y %T") EXIT: fuse-mount.cron already running."
  11. exit 1
  12. fi
  13.  
  14. if [[ -f "/home/wut/tv/mountcheck" ]]; then
  15. echo "$(date "+%d.%m.%Y %T") INFO: Check successful, fuse 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/tv | tee -a "$logfile"
  21. /usr/bin/unionfs-fuse -o cow,allow_other /home/wut/plex-tv-r=RW:/home/wut/acd-tv=RO /home/wut/tv
  22.  
  23. if [[ -f "/home/wut/tv/mountcheck" ]]; then
  24. echo "$(date "+%d.%m.%Y %T") INFO: Remount successful." | tee -a "$logfile"
  25. else
  26. echo "$(date "+%d.%m.%Y %T") CRITICAL: Remount failed." | tee -a "$logfile"
  27. fi
  28. fi
  29. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement