HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Automate Mount point check
Operating System - Linux
1828410
Members
3676
Online
109977
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2007 04:17 AM
04-03-2007 04:17 AM
Automate Mount point check
Hi Experts ,
I need your help to get a script which will check eack time the system is rebooted or crashed and recoverd , that scripts has to check is all the mount points are mounted ? If not its has to intimate by sending mail.[Including the NFS mount points]
Thanks in Advance
I need your help to get a script which will check eack time the system is rebooted or crashed and recoverd , that scripts has to check is all the mount points are mounted ? If not its has to intimate by sending mail.[Including the NFS mount points]
Thanks in Advance
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2007 04:32 AM
04-03-2007 04:32 AM
Re: Automate Mount point check
This is a case of the tail wagging the dog. While what you are asking is certainly "doable" (e.g. scripts in rc to tell you when the machine boots) and scanning /etc/fstab and comparing it to df output for each filesystem, the approach is fundamentally flawed. The real answer is to fix your crashes. I cannot imagine a situation where a machime crashes and reboots itself without my knowledge -- or that others can reboot a box without my knowledge.
It's also not enough to know that all the filesystems mounted correctly at boot, you should be doing those checks on either a continuous or periodic automatic basis so that the special case of a reboot is handled implicitly by your already existing monitoring daemons.
It's also not enough to know that all the filesystems mounted correctly at boot, you should be doing those checks on either a continuous or periodic automatic basis so that the special case of a reboot is handled implicitly by your already existing monitoring daemons.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2007 04:37 AM
04-03-2007 04:37 AM
Re: Automate Mount point check
One way..
awk '/nfs/ {print $2}' /etc/fstab|\
while read list
do
OK=
OK=`mount|awk -v x=$list '$1 == x {print "OK"}'`
if [[ $OK != "OK" ]]
then
if [[ $1 = "MANUAL" ]]
then
echo "$list is NOT mounted.. Now executing mount command !! - `date`"
fi
#echo "$list is NOT mounted.. Now executing mount command !! - `date`"|mailx -m -s "INFO - `hostname` NFS info" ux-admin
mount $list > $LOG 2>&1
:
else
if [[ $1 = "MANUAL" ]]
then
echo "$list - $OK"
fi
:
fi
done
awk '/nfs/ {print $2}' /etc/fstab|\
while read list
do
OK=
OK=`mount|awk -v x=$list '$1 == x {print "OK"}'`
if [[ $OK != "OK" ]]
then
if [[ $1 = "MANUAL" ]]
then
echo "$list is NOT mounted.. Now executing mount command !! - `date`"
fi
#echo "$list is NOT mounted.. Now executing mount command !! - `date`"|mailx -m -s "INFO - `hostname` NFS info" ux-admin
mount $list > $LOG 2>&1
:
else
if [[ $1 = "MANUAL" ]]
then
echo "$list - $OK"
fi
:
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2007 04:38 AM
04-03-2007 04:38 AM
Re: Automate Mount point check
Hi:
Hmmmm. A sound running system should not encounter these conditions. If you can't mount filesystems, you have issues that need to be resolved. However, you could construct something like this and if it gives you "warm-fuzzies" you could add it as a run-level-3 'rc' script in '/sbin/init.d':
#!/usr/bin/sh
while read DEV MNTPT X
do
grep -q "${MNTPT}" /etc/mnttab || \
mailx -s "${MNTPT} isn't mounted!" root < /dev/null
done < /etc/fstab
Regards!
...JRF...
Hmmmm. A sound running system should not encounter these conditions. If you can't mount filesystems, you have issues that need to be resolved. However, you could construct something like this and if it gives you "warm-fuzzies" you could add it as a run-level-3 'rc' script in '/sbin/init.d':
#!/usr/bin/sh
while read DEV MNTPT X
do
grep -q "${MNTPT}" /etc/mnttab || \
mailx -s "${MNTPT} isn't mounted!" root < /dev/null
done < /etc/fstab
Regards!
...JRF...
- Tags:
- mnttab
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP