/usr/sbin/start-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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | #!/bin/bash
# Script that starts the ns-slapd server.
# Exit status can be:
# 0: Server started successfully
# 1: Server could not be started
# 2: Server already running
. /usr/share/dirsrv/data/DSSharedLib
# Starts a single instance
start_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 1 ; }
# source env. for this instance
if [ -f $initfile ] ; then
. $initfile
else
echo Instance $SERV_ID not found.
return 1
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
DS_CONFIG_DIR=$CONFIG_DIR
export DS_CONFIG_DIR
PIDFILE=$RUN_DIR/$PRODUCT_NAME-$SERV_ID.pid
if test -f $PIDFILE ; then
PID=`cat $PIDFILE`
if kill -s 0 $PID > /dev/null 2>&1 ; then
echo There is an ns-slapd running: $PID
return 2;
else
rm -f $PIDFILE
fi
fi
#
# Use systemctl if available and running as root,
# otherwise start the instance the old way.
#
if [ -d "/lib/systemd/system" ] && [ $(id -u) -eq 0 ];then
/bin/systemctl start dirsrv@$SERV_ID.service
if [ $? -ne 0 ]; then
return 1
fi
else
if test 1 -eq 0; then
echo "NOTICE: Starting instance ${SERV_ID} with ASAN options."
echo "This is probably not what you want. Please contact support."
: ${ASAN_LOG_PATH:=$RUN_DIR/ns-slapd-${SERV_ID}.asan}
echo "Asan errors will go to ${ASAN_LOG_PATH}*"
export ASAN_OPTIONS="detect_leaks=1 symbolize=1 detect_deadlocks=1 log_path=${ASAN_LOG_PATH}"
export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer
fi
$SERVERBIN_DIR/ns-slapd -D $CONFIG_DIR -i $PIDFILE "$@"
if [ $? -ne 0 ]; then
return 1
fi
fi
loop_counter=1
# wait for 10 minutes (600 times 1 seconds)
max_count=${PID_TIME:-600}
while test $loop_counter -le $max_count; do
loop_counter=`expr $loop_counter + 1`
if test -f $PIDFILE ; then
PID=`cat $PIDFILE`
# if kill -s 0 $PID > /dev/null 2>&1 ; then
if kill -s 0 $PID ; then
return 0;
else
echo Server failed to start !!! Please check errors log for problems
return 1
fi
else
sleep 1
fi
done
echo Server not running!! Failed to start ns-slapd process. Please check the errors log for problems.
return 1
}
# 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 starting 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 Starting instance \"$inst\"
start_instance $inst
rv=$?
if [ $rv -ne 0 ]; then
ret=$rv
fi
done
exit $ret
else
# We're starting a single instance.
start_instance $@
exit $?
fi
|