/usr/sbin/status-dirsrv is in 389-ds-base 1.3.7.10-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #!/bin/sh
# Script that reports the status of the ns-slapd server.
. /usr/share/dirsrv/data/DSSharedLib
# Get the status of a single instance
status_instance() {
# The first argument is the server ID. Anything
# after that is an argument to ns-slapd.
SERV_ID=$1
shift
initfile=`get_init_file $initconfig_dir $SERV_ID` || { echo Instance $SERV_ID not found. ; return 255 ; }
# source env. for this instance
if [ -f $initfile ] ; then
. $initfile
else
echo Instance $SERV_ID not found.
return 255
fi
prefix="$DS_ROOT"
libpath_add "$prefix$SERVER_DIR"
libpath_add "$prefix"
libpath_add "$prefix/usr/lib/x86_64-linux-gnu"
libpath_add ""
libpath_add "$prefix/usr/lib/x86_64-linux-gnu"
export LD_LIBRARY_PATH
SHLIB_PATH=$LD_LIBRARY_PATH
export SHLIB_PATH
#
# Use systemctl if available.
#
if [ -d "/lib/systemd/system" ] && [ $(id -u) -eq 0 ];then
/usr/bin/systemctl status dirsrv@$SERV_ID.service -l
rv=$?
if [ $rv -ne 0 ]; then
return 1
fi
fi
return 0
}
# source env. for all instances
[ -f /etc/default/dirsrv ] && . /etc/default/dirsrv
while getopts "d:" flag
do
case "$flag" in
d) initconfig_dir="$OPTARG";;
esac
done
shift $(($OPTIND-1))
if [ -z "$initconfig_dir" ]; then
initconfig_dir=/etc/default
fi
found=0
if [ $# -eq 0 ]; then
# We're reporting the status of all instances.
ret=0
/usr/bin/systemctl status dirsrv.target -l
initfiles=`get_initconfig_files $initconfig_dir` || { echo No instances found in $initconfig_dir ; exit 1 ; }
for i in $initfiles; do
inst=`normalize_server_id $i`
echo Status of instance \"$inst\"
status_instance $inst
rv=$?
#if one of them is successful, return 0.
if [ $rv -ne 0 ]; then
ret=`expr $ret + 1`
fi
done
exit $ret
else
# We're getting the status of a single instance.
status_instance $@
exit $?
fi
|