Yet another Linux Domino start/stop script - Comments Please

We needed a script that both started Domino in a screen session and handled id’s with passwords… looked over the scripts here and most were either too complex or didn’t meet my needs… so here’s my version. I would appreciate any comments and/or suggestions on how perhaps to make it better or if another set of eyes can spot any major gaffs… seems to work ok for us so far…

Thanx…

Also… in order for the script to operate properly… the Domino user (in our case notes) needs the following two lines added to to the .screenrc file:

multiuser on

addacl root

Here’s the script:

#!/bin/sh

Domino init.d script

DOM_HOME: Domino data directory

DOM_USER: Linux account to run Domino server

DOM_PROG: Domino executable directory

DOM_VERS: Domino version

DOM_SECT: Domino id password file. One line with password.

DOM_SVER: Script Version

04/20/05 smg initial version

05/05/05 smg add file support for password

DOM_HOME=/local/notesdata

DOM_USER=notes

DOM_PROG=/opt/lotus/bin

DOM_VERS=6.5.3

DOM_SECT=“/home/notes/.domino.pass”

DOM_SVER=“0.1”

Nothing to modify below here…

sh_status ()

{

echo -e “\nRunning Domino Tasks ($DOM_VERS)”

echo “____________________________”

cat $DOM_HOME/pid.nbf | grep “^1” | grep -v nsd.sh

echo “”

}

DOM_RUN=ps -ef | grep -v grep | grep $DOM_PROG

if [ -f $DOM_SECT ]; then

DOM_PASS=` head -n 1 $DOM_SECT | sed 's/^[ \t]*//;s/[ \t]*$//'`

else

DOM_PASS=""

fi

case “$1” in

start)

echo -n -e "\nStarting Domino $DOM_VERS Server: "

if [ -n “$DOM_RUN” ]; then

echo "Whoa! Domino is already running... aborting startup"

echo ""

sh_status

exit 1

fi

su - $DOM_USER -c “cd $DOM_HOME && screen -d -m -S Domino $DOM_PROG/server”

if [ “$DOM_PASS” != “” ]; then

su - $DOM_USER -c "screen -p 0  -X eval 'stuff $DOM_PASS\015'"

fi

echo “Domino Server $DOM_VERS Started…”

echo “”

exit 0

;;

stop)

echo -e -n "\nStopping Domino $DOM_VERS Server: "

if [ -z “$DOM_RUN” ]; then

echo "Whoa! Domino is not running... aborting shutdown"

echo ""

exit 1

else

echo ""

fi

cd $DOM_HOME

echo Y | su $DOM_USER -c “$DOM_PROG/server -q”

exit 0

;;

status)

sh_status

;;

*)

echo -e “\nDomino init.d script ver. $DOM_SVER”

echo “Steve Grzywinski @ Superior Technology Group”

echo “”

echo “usage: /etc/init.d/domino {start|stop|status}”

echo “”

;;

esac