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/fuse-mount.cron >/dev/null 2>&1
- # Make script executable with: chmod a+x /home/scripts/fuse-mount.cron
- logfile="/home/wut/scripts/logs/fuse-mount.cron.log"
- if pidof -o %PPID -x "fuse-mount.cron"; then
- echo "$(date "+%d.%m.%Y %T") EXIT: fuse-mount.cron already running."
- exit 1
- fi
- if [[ -f "/home/wut/tv/mountcheck" ]]; then
- echo "$(date "+%d.%m.%Y %T") INFO: Check successful, fuse 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/tv | tee -a "$logfile"
- /usr/bin/unionfs-fuse -o cow,allow_other /home/wut/plex-tv-r=RW:/home/wut/acd-tv=RO /home/wut/tv
- if [[ -f "/home/wut/tv/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