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 : check_slapd_schema [-d] [-h] [options]
-u Sudo as specified user to run slapschema
-s Path to slapschema (Default : auto-detected)
-n Slapd database ID (Default : auto-detected)
-b Slapd database base DN (Default : auto-detected)
-d Debug mode
-h Show this message
```
Copyright
---------

View file

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