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