#!/bin/sh
function start {
su ${DOMINO_USR} -c "$DOMINO_BIN -jc -c"
}
function stop {
su ${DOMINO_USR} -c "echo Y| $DOMINO_BIN -jc -q"
# set the domino path and user name under which domino will run
DOMINO_BIN=/opt/ibm/domino/bin/server
test -x $DOMINO_BIN || exit 5
DOMINO_USR=notes
cd /notesdata
[ -f .init ] && . ./.init
case "$1" in
setup)
if [ ! -d /data ]; then
echo "Please start with -v <SRC>:/data, so that your domino data can be initiated" && exit 1
fi
echo "Domino setup is listening on 1352"
su ${DOMINO_USR} -c "${DOMINO_BIN} -listen 1352"
cp -pR /notesdata/* /data/
echo "Please start domino with -v <SRC>:/notesdata"
;;
start)
trap 'stop' SIGTERM
MAX_OPEN_FILES=`ulimit -n`
if [ $MAX_OPEN_FILES -lt 60000 ]; then
echo "setting maximum open files to 60000"
ulimit -n 60000
# Change our primary interface address for traveler
OURIP=$(ip route get $(ip route show 0.0.0.0/0 | grep -oP 'via \K\S+') | grep -oP 'src \K\S+')
sed -i -r "s/^(NTS_HOST_IP_ADDR)=[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/\1=${OURIP}/" notes.ini
echo -n "Starting Domino server"
start &
wait
stop)
echo -n "Shutting down Domino server"
stop
*)
echo "Usage: $0 {setup|start|stop}"
exit 1
esac