From b13c7ea8c58de76d51d478c064abab0fe652d00f Mon Sep 17 00:00:00 2001 From: Cyberes Date: Sat, 22 Jun 2024 20:10:20 -0600 Subject: [PATCH] adjust --- check_nfs_exports.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/check_nfs_exports.sh b/check_nfs_exports.sh index 2845987..20003e4 100755 --- a/check_nfs_exports.sh +++ b/check_nfs_exports.sh @@ -1,11 +1,11 @@ #!/bin/bash print_help() { - echo "Usage: $0 -h -s " - echo "Checks if the specified NFS shares are exported on the given host." + echo "Usage: $0 -h -s " + echo "Checks if the specified NFS exports are exported on the given host." echo "" echo "-h The IP address or hostname of the NFS server." - echo "-s A comma-separated list of NFS shares to check. For example: '/mnt/test,/mnt/export'" + echo "-e A comma-separated list of NFS exports to check. For example: '/mnt/test,/mnt/export'" echo "" echo "You can list the exported shares on an NFS server using the command 'showmount -e '" echo "This script assumes that 'showmount' is installed on the system where it is run." @@ -21,13 +21,13 @@ if [ "$#" -ne 4 ] || [ "$1" == "--help" ]; then print_help fi -while getopts "h:s:" opt; do +while getopts "h:e:" opt; do case ${opt} in h ) host=$OPTARG ;; - s ) - shares=$OPTARG + e ) + exports=$OPTARG ;; \? ) print_help @@ -38,7 +38,7 @@ done share_count=0 all_ok=true -IFS=',' read -r -a share_array <<< "$shares" +IFS=',' read -r -a share_array <<< "$exports" for share in "${share_array[@]}"; do output=$(showmount -e $host | grep $share) @@ -50,7 +50,7 @@ for share in "${share_array[@]}"; do done if $all_ok; then - echo "OK - All $share_count shares are exported on $host | share_count=$share_count" + echo "OK - $share_count NFS exports on $host | share_count=$share_count" fi exit 0