/usr/sbin/restart-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 | #!/bin/bash
# Script that restarts the ns-slapd server.
# Exit status can be:
# 0: Server restarted successfully
# 1: Server could not be started
# 2: Server started successfully (was not running)
# 3: Server could not be stopped
. /usr/share/dirsrv/data/DSSharedLib
restart_instance() {
SERV_ID=$1
server_already_stopped=0
/usr/sbin/stop-dirsrv -d $initconfig_dir $SERV_ID
status=$?
if [ $status -eq 1 ] ; then
return 3;
else
if [ $status -eq 2 ] ; then
server_already_stopped=1
fi
fi
/usr/sbin/start-dirsrv -d $initconfig_dir $SERV_ID
status=$?
if [ $server_already_stopped -eq 1 ] && [ $status -eq 0 ] ; then
return 2;
fi
return $status
}
while getopts "d:" flag
do
case "$flag" in
d) initconfig_dir="$OPTARG";;
esac
done
shift $(($OPTIND-1))
if [ "$initconfig_dir" = "" ]; then
initconfig_dir=/etc/default
fi
if [ "$#" -eq 0 ]; then
# We're restarting all instances.
ret=0
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 Restarting instance \"$inst\"
restart_instance $inst
rv=$?
if [ "$rv" -ne 0 ]; then
ret=$rv
fi
done
exit $ret
else
# We're restarting a single instance.
restart_instance $*
exit $?
fi
|