Add -b parameter

This commit is contained in:
Benjamin Renard 2021-11-30 15:03:00 +01:00
parent 15ca2f3f35
commit 121ce64651
2 changed files with 16 additions and 7 deletions

View file

@ -21,12 +21,15 @@ service nagios-nrpe-server reload
Usage Usage
----- -----
Usage : check_slapd_schema [-d] [-h] [options] ```
Usage : check_slapd_schema [-d] [-h] [options]
-u Sudo as specified user to run slapschema -u Sudo as specified user to run slapschema
-s Path to slapschema (Default : auto-detected) -s Path to slapschema (Default : auto-detected)
-n Slapd database ID (Default : auto-detected) -n Slapd database ID (Default : auto-detected)
-b Slapd database base DN (Default : auto-detected)
-d Debug mode -d Debug mode
-h Show this message -h Show this message
```
Copyright Copyright
--------- ---------

View file

@ -10,6 +10,7 @@
SUDO_USER="" SUDO_USER=""
SLAPSCHEMA=slapschema SLAPSCHEMA=slapschema
DB_ID="" DB_ID=""
DB_BASEDN=""
DEBUG=0 DEBUG=0
function debug() { function debug() {
@ -25,12 +26,13 @@ Usage : $0 [-d] [-h] [options]
-u Sudo as specified user to run slapschema -u Sudo as specified user to run slapschema
-s Path to slapschema (Default : auto-detected) -s Path to slapschema (Default : auto-detected)
-n Slapd database ID (Default : auto-detected) -n Slapd database ID (Default : auto-detected)
-b Slapd database base DN (Default : auto-detected)
-d Debug mode -d Debug mode
-h Show this message -h Show this message
EOF EOF
} }
while getopts "hu:s:n:d" OPTION while getopts "hu:s:n:b:d" OPTION
do do
case $OPTION in case $OPTION in
u) u)
@ -42,6 +44,9 @@ do
n) n)
DB_ID=$OPTARG DB_ID=$OPTARG
;; ;;
b)
DB_BASEDN=$OPTARG
;;
d) d)
DEBUG=1 DEBUG=1
;; ;;
@ -58,6 +63,7 @@ done
CMD="$SLAPSCHEMA" CMD="$SLAPSCHEMA"
[ -n "$DB_ID" ] && CMD="$CMD -n $DB_ID" [ -n "$DB_ID" ] && CMD="$CMD -n $DB_ID"
[ -n "$DB_BASEDN" ] && CMD="$CMD -b $DB_BASEDN"
debug "slapschema command = '$CMD'" debug "slapschema command = '$CMD'"
if [ -n "$SUDO_USER" ] if [ -n "$SUDO_USER" ]