-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfilesystem_mount_check.sh
More file actions
34 lines (31 loc) · 1.18 KB
/
filesystem_mount_check.sh
File metadata and controls
34 lines (31 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
echo "Checking for mounting at `date`" >> /var/log/mounting_check.log
is_mounted=0
total_mount=0
>|/var/log/mounting_check.log
for mount_point in `cat /etc/fstab | awk '{print $1}' | grep -vE '#|swap' | grep '^/'`
do
echo "checking for ${mount_point}" >> /var/log/mounting_check.log
for mount_check in `df -h | awk '{print $1}' | grep '^/'`
do
if [ ${mount_check} == ${mount_point} ]
then
is_mounted=1
total_mount=`expr $total_mount + 1`
fi
done
if [ $is_mounted -ne 1 ]
then
echo "Mount point not available for ${mount_point}" >> /var/log/mounting_check.log
else
echo "Mount point available for ${mount_point}" >> /var/log/mounting_check.log
fi
done
if [ `cat /etc/fstab | awk '{print $1}' | grep -vE '#|swap' | grep '^/' | wc -l` -ne ${total_mount} ]
then
#echo "Mounting is not available for server, please check /var/log/mounting_check.log logs for more info." | mail -s
echo "mount not available please check" >>/var/log/mounting_check.log
else
echo "all mount are available" >> /var/log/mounting_check.log
fi
echo "Mount check completed at `date`" >> /var/log/mounting_check.log