Re: Monitor mount points

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2006-01-24 at 16:28 -0500, Devon Harding wrote:
> Is there a way I could monitor mount points & automatically remount
> them (mount -a) if its ever disconnected?

Uhm, yeah.  I do it.  Cheap and dirty way:

--------------------- CUT HERE ---------------------------------------
#!/bin/bash
MNTLIST="/mountpoint1 /mountpoint2 ..." # Build list of dirs to check
for MNT in $MNTLIST; do                 # For each directory...
    RES=`mount | grep $MNT`             # Perform the check
    if [ $? -ne 0 ]; then               # Did we get a failure?
        mount $MNT                      # Yes, remount the volume
    fi
done
--------------------- CUT HERE ---------------------------------------

Save that as a shell script, say "/usr/local/bin/chkmnt.sh", chown it
as root:root and chmod it to 755.  Finally, add an entry to root's
crontab:

	* * * * * /usr/local/bin/chkmnt.sh >/dev/null 2>&1

which will run it once a minute.  You could add things such as touching
a file on each directory to verify the thing is writable and such.  It's
up to you.

----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens@xxxxxxxxxxxxxxx -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
- ...Had this been an actual emergency, we would have fled in terror -
-                      and you'd be on your own, pal!                -
----------------------------------------------------------------------


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux