Anons79 Mini Shell

Directory : /usr/local/nagios/plugins/
Upload File :
Current File : //usr/local/nagios/plugins/check_ro_fs.sh

#!/bin/sh

_ret() { # syntax - ret message errorcode
echo $1
exit $2
}

FSTAB='/etc/fstab'
MP='/backup'

if ! [ -f $FSTAB ]; then _ret 'no fstab' 2; fi;

if ! $(awk '{print $2}' $FSTAB | grep -q "^$MP$"); then _ret "wrong fstab" 1; fi;

if ! MOUNTS=$(cat /proc/mounts | grep $MP | awk '{print $4}'); then _ret "not mounted" 2; fi;

#if [ $MOUNTS = "(ro.*$" ]; then _ret "/backup is mounted read-only" 2; fi; 

case $MOUNTS in
    ro,*)
        _ret "/backup is mounted read-only" 2
    ;;

    *)
        _ret "OK" 0
    ;;
esac


Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]