wissel.net

Usability - Productivity - Business - The web - Singapore & Twins

Starting Domino on Linux using UPSTART


When running Domino on a proper platform (AIX, Solaris, Linux) starting and stopping the Domino server was left to customizing a script from a technote or a Redbook's FTP site, as far as official IBM resouces go. Of course the professional source is Daniel Nashed's ultimate Domino startup script. One script to rule them all.
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:
# Sample job script for domino, experimental - use at your own risk, don't use in production
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
Secondly you create the configuration file in /etc/domino/server1.conf (you need to create the directory if needed, it isn't there by default):
#Configuration variables for Domino instance startup
#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"
The script will be able to start the domino instance using 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:
description 'Start all domino instances at boot'
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
That's all you need. As usual YMMV.

Posted by on 25 September 2012 | Comments (0) | categories: Linux Show-N-Tell Thursday

Comments

  1. No comments yet, be the first to comment