Monitor mount points
Devon Harding
devonharding at gmail.com
Tue Jan 24 22:39:13 UTC 2006
Works like a champ!
Thanks!
On 1/24/06, Rick Stevens <rstevens at vitalstream.com> wrote:
>
> 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 at vitalstream.com -
> - 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! -
> ----------------------------------------------------------------------
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20060124/f703d516/attachment-0001.htm>
More information about the fedora-list
mailing list