Das Notes Forum

Lotus Notes / Domino Sonstiges => Tipps und Tricks => Thema gestartet von: Meff am 21.01.03 - 09:59:02

Titel: Serverstartscript für Dominoserver unter Linux
Beitrag von: Meff am 21.01.03 - 09:59:02
Hallo Forum,

anbei ein Startscript für einen Dominoserver unter Linux. Getestet unter Suse 8.0 und Dominorelease 6.



#!/bin/bash
# Domino Server Startup script (iboernig@suse.de)
# /sbin/init.d/domino
#

. /etc/rc.config
. /etc/profile.d/lotus.sh

START_DOMINO=yes

# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}

# Force execution if not called by a runlevel directory.
test $link = $base && START_DOMINO=yes
test "$START_DOMINO" = yes || exit 0

NOTES_SERVER=domino
OUTPUT_LOG=/var/log/notes/$NOTES_SERVER.log
INPUT_FILE=/var/log/notes/$NOTES_SERVER.input

# Set higher values for shared memory and file handels in the kernel
echo "134217728"> /proc/sys/kernel/shmmax
echo "16376" > /proc/sys/fs/file-max
# echo "32752" > /proc/sys/fs/inode-max
ulimit -n 8192

# The echo return value for success (defined in /etc/rc.config).
return=$rc_done
case "$1" in
start)
echo -n "Starting Lotus Domino server"
test -f $INPUT_FILE || su - $NOTES_USER -c "touch $INPUT_FILE"
test -f $INPUT_FILE && su - $NOTES_USER -c "rm $INPUT_FILE; touch $INPUT_FILE"
su - $NOTES_USER -c "/opt/lotus/bin/server <$INPUT_FILE >$OUTPUT_LOG 2>&1 &" || return=$rc_failed

echo -e "$return"
;;
stop)
echo "Shutting down Lotus Domino server"
echo "... waiting for shutdown to complete"
echo "quit" >> $INPUT_FILE
#
#
count=0
NOTES_RUNNING=`ps -fu notes |grep /opt/lotus | awk '{print $2}'`
while [ "$NOTES_RUNNING" ] ; do
sleep 10
count=`expr $count + 1`
echo ".. waiting "$count"0 seconds"
if [ $count -eq 13 ] ; then
echo "Domino is still running after 2 minutes"
echo "... now for the ungraceful method"

cd $NOTES_PATH
rm "~notes.lck"

for i in `ps -fu notes |grep /opt/lotus | awk '{print $2}'`; do
kill -9 $i
done

mems=`ipcs -m |grep $NOTES_USER | awk '{print $2}'`
sems=`ipcs -s |grep $NOTES_USER | awk '{print $2}'`

for j in $mems; do ipcrm shm $j ; done >/dev/null 2>&1
for j in $sems; do ipcrm sem $j ; done >/dev/null 2>&1

exit
fi
NOTES_RUNNING=`ps -fu notes |grep /opt/lotus | awk '{print $2}'`
done
echo -n "Domino server shutdown completed"
echo -e "$return"
;;
restart)
## If first returns OK call the second, if first or
## second command fails, set echo return value.
$0 stop && $0 start || return=$rc_failed
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac

# Inform the caller not only verbosely and set an exit status.
test "$return" = "$rc_done" || exit 1
exit 0



Am einfachster könnt Ihr diesen Startscript mittels Webmin erstellen (http://www.webmin.com), hier einfach ein neues Startscript erstellen. Oder Ihr macht einfach folgendes :

In /etc/init.d erstellt Ihr ein File namens domino und packt dort den obigen Script rein. Anschliessend müssen noch ein Symlink in euer Runlevel Verzeichniss erstellt werden (z.B. /etc/rc.d/rc3.d/S25domino und /etc/rc3.d/K02domino).



So, jetzt noch ein File in /etc/profile.d namens lotus.sh erstellen (mit root Rechten). Inhalt des Files ist :

#
# /etc/profile.d/lotus.sh
#

export NOTES_USER=notes
export NOTES_PATH=/opt/lotus/data
export LOTUSDIR=/opt/lotus

#
# Path for notes-user
#
if [ "$LOGNAME" = $NOTES_USER ]; then
export PATH=$PATH:$LOTUSDIR/bin:$NOTES_PATH:$LOTUSDIR/notes/latest/linux/
fi

ACHTUNG : In diesem Fall sind die Dominoserver Executables in /opt/lotus und das Datadirectory in /opt/lotus/data. Falls das bei euch anders ist, bitte entsprechend anpassen.

Und zu guter Letzt noch folgendes :

Im Verzeichnis /var/log erstellt Ihr ein Verzeichnis namens 'notes' und dem User, mit welchem der Server läuft Zugriffsrechte (rwx r x r x). In diesem Verzeichnis erstellt Ihr zwei leere Files mit dem Namen :

domino.input
domino.log

Auf diese beiden Verzeichnisse benötigt der Dominoserveruser ebenfalls Rechte.

Und das wars schon. Beim nächsten Maschinenreboot startet der Dominoserver von selber.

Meff ;)

P.S.: Ihr könnt die Logfiles auch als Console nutzen :

'cat >> /var/log/notes/domino.input | tail -f /var/log/notes/domino.log' auf der Kommandozeile eingeben.
Titel: Re:Serverstartscript für Dominoserver unter Linux
Beitrag von: Rob Green am 21.01.03 - 14:17:50
wenn das ausgetestet ist, kann ich das wirklich gut gebrauchen. Möchte demnächst auf Susebasis R6 installieren.

Dankeschön  :)
Titel: Re:Serverstartscript für Dominoserver unter Linux
Beitrag von: Meff am 21.01.03 - 14:26:47
Das Script soll angeblich auch für R5 Server funzen, allerdings habe ich es dort noch nicht eingesetzt und getestet.

Meff ;)
Titel: Re:Serverstartscript für Dominoserver unter Linux
Beitrag von: BEamer am 22.01.03 - 07:44:15
Das Script tut es unter SuSE-Linux ;)

Haben es schon seit einiger Zeit in so ähnlicher Form im Einsatz.
Titel: Re:Serverstartscript für Dominoserver unter Linux
Beitrag von: Meff am 22.01.03 - 09:27:32
Funktioniert ebenfalls : Suse 7.0 mit Domino 5.0.11