Starting Domino on Linux using UPSTART
On Linux however the way services are started has changed a while ago. The prefered method (definitely in Ubuntu, but also Fedora, RedHat and OpenSuse as option) is Upstart (there seems to be a push towards systemd, but that's a story for another time).
Upstart allows for a more flexible control and faster boot times of your environment. To configure your Domino on Linux we will use 2 scripts and one configuration file for each instance (inspired by the same approach for node.js).
The first file is
/etc/init/domino.conf
with the following content:
description 'lotus domino upstart script'
author '@notessensei'
#Stop on shutdown - but no start directive - since it gets started by another script
stop on shutdown
#Instance allows for multiple scripts running
instance "Domino - $NAME"
# Restart if it was crashing, with a limit
respawn
respawn limit 5 60
# Will go into the background
expect fork
# Kill timeout 20 sec - to give Domino a shutdown chance
kill timeout 20
# Check for the password file
pre-start script
. /etc /domino / $NAME.conf
# Ensure the pwd file is there and has the right owner/access
if [ ! -f $PWD_LOCATION ]; then
touch PWD_LOCATION
fi
chmod 0400 $PWD_LOCATION
chown $SERVER_USER: $SERVER_GROUP $PWD_LOCATION
end script
# The script to start the server
script
. /etc /domino / $NAME.conf
exec sudo -u $SERVER_USER -c "cd ${DATA_LOCATION}; cat ${PWD_LOCATION}|PWD_LOCATION/server" >> $LOG_TO 2 >& 1 &
end script
# Run before shutdown - tell Domino to go down peacefully
pre-stop script
. /etc /domino / $NAME.conf
exec sudo -u $SERVER_USER -c "cd ${DATA_LOCATION}; /opt/ibm/lotus/bin/server -q"
end script
# Make sure it is really dead
post-stop script
. /etc /domino / $NAME.conf
exec sudo -u $SERVER_USER -c "cd ${DATA_LOCATION}; /opt/ibm/lotus/bin/nsd -kill"
end script
/etc/domino/server1.conf
(you need to create the directory if needed, it isn't there by default):
#User and group for Domino
SERVER_USER= "domino"
SERVER_GROUP= "domino"
#Where does the data go
DATA_LOCATION= "/home/domino/server1/data"
#Must exist and have 0400 doe SERVER_USER:SERVER_GROUP
PWD_LOCATION= "${DATA LOCATION}/.domino.pwd"
#Log file
LOG_TO= "${DATA LOCATION}/domino.log"
start domino NAME=server1
. For additional instances ( partitioned servers) you only need to create an additional conf file in /etc/domino.
The final missing piece is the script that starts all the configured instances. Here we can more or less copy Ian's node script as
/etc/init/alldomino.conf
:
author '@notessensei'
start on (local-filesystems and net-device-up )
task
script
for file in ` ls /etc /domino /*.conf ` ; do
filename= ` basename ${file%.*} `
start domino NAME= $filename
done
end script
Posted by Stephan H Wissel on 25 September 2012 | Comments (0) | categories: Linux Show-N-Tell Thursday