Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. count_current=`df -hTP | grep -v Filesystem|awk '{print $1}'|wc -l`
  4. echo "Currently mounted filesystems count is:" $count_current
  5. count_fstab=`cat /etc/fstab | grep -v '#'|awk '{print $1}'|wc -l`
  6. echo "Total number of filesystems are:" $count_fstab
  7. readonly differ=$(( count_current - count_fstab ))
  8. if (( differ -eq $((count_current - count_fstab)) ))
  9. then
  10. echo "All filesystems are mounted correctly"
  11.  
  12. else
  13. echo "checking on it"
  14. fi
  15.  
  16. [root@host ~]# ./script
  17. Currently mounted filesystems count is: 10
  18. Total number of filesystems are: 15
  19. All filesystems are mounted correctly
  20. [root@host ~]# umount /var/crash
  21. [root@host ~]# ./script
  22. Currently mounted filesystems count is: 9
  23. Total number of filesystems are: 15
  24. All filesystems are mounted correctly
  25. [root@host ~]#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement