Stop script for stopping an D6 server with controller on AIX?

Last week I changed the startup script for one of my Domino 6 servers on AIX so that it starts the Domino Controller (by adding the -jc -c option to the server command). However, the stop script which is automatically run before Tivoli backs up the whole machine hasn’t been changed and now has the effect that the server doesn’t want to come up after the backup because of a .jsc_lock file. The exact message is:

"Unable to start Domino Server Controller:

Another instance is either already running in this directory or terminated abnormally without removing the file ‘.jsc_lock’ from the data directory. If requried, manually delete the file and run again."

Does anyone know of a more graceful method to stop a D6 server with controller on AIX?

Subject: It would be helpful to show how the script is stopping the server

Subject: here’s the present stop script

#!/bin/ksh ###############################################################

Domino Application Server Stop Domino Server Script

Licensed Materials - Property of IBM

(C) COPYRIGHT International Business Machines Corp 1994, 1998

All Rights Reserved.

###############################################################

Description - stop_domino

This is the sript to stop the Domino server which has been started

using the corresponding script start_domino.

The script attempts to quit the server gracefully and waits 1 minute.

###############################################################

Set script environment variables

. /home/notes1/scripts/env_domino

Script logic

if ((id -u == 0))

then

print "Stop the domino server as the $NOTES_USER user "

exit

fi

if [ ! -x /opt/lotus/bin/server ]

then

echo "Cannot access server command - exiting "

exit 1

fi

if [ ! -d $NOTES_PATH ]

then

echo "Cannot access notes data directory - exiting "

exit 1

fi

print “Stopping Domino for AIX ($NOTES_SERVER)”

print " … waiting for shutdown to complete"

echo " quit " >> $INPUT_FILE

count=0

NOTES_RUNNING=“ps -fu $NOTES_USER | grep lotus | grep -v grep

while [[ -n $NOTES_RUNNING ]] ; do

sleep 10

count=expr $count + 1

echo " … waiting “$count"0 seconds”

Terminate if Domino server is still running

if [ $count -eq 6 ] ; then

echo “Domino Server is still running after 1 minute”

echo " … now for the ungraceful method"

for i in ps -fu $NOTES_USER | grep lotus | grep -v grep | awk ' {print $2 }' ; do

   kill -9 $i

done

mems=ipcs | grep $NOTES_USER | awk '{ print $1 $2 }' | awk -F'm' '{ print $2 }' | awk '{ print $1 }'

sems=ipcs | grep $NOTES_USER | awk '{ print $1 $2 }' | awk -F's' '{ print $2 }' | awk '{ print $1 }'

for j in $mems;do if [ -n “$j” ] ; then ipcrm -m $j;fi;done

for j in $sems;do if [ -n “$j” ] ; then ipcrm -s $j;fi;done

echo “Domino server ($NOTES_SERVER) Terminated!”

exit

fi

NOTES_RUNNING=“ps -fu $NOTES_USER | grep lotus | grep -v grep

done

echo “Domino for AIX ($NOTES_SERVER) shutdown completed.”

Subject: RE: here’s the present stop script

print "Stopping Domino for AIX ($NOTES_SERVER)“print " … waiting for shutdown to complete”

echo " quit " >> $INPUT_FILE

I am assuming by typing “quit” to $INPUT_FILE you are asking domino server to quit. By doing this you have asked only server to quit not the server controller. Controller still stays running and keeps the .jsc_lock file. However, when you start the server from your start script as “server -jc” or “server -jc -c”, you are asking server controller to start in the same partition. While coming up, it realizes that there is a controller already running and hence that message you are seeing.

We have a way to stop the controller and server interactively by typing “server -jc -q” which prompts for confirmation. We could fix in future to do with out asking for confirmation so that you could stop from scripts.

For now, you could change your stop script to look for a java process with “DominoController” as a string in that and kill. This should be done after all server processes exit.

Subject: RE: here’s the present stop script

would “echo y | server -jc -q” work?

Subject: RE: here’s the present stop script

No it won’t work that way straight. But you have to be explict as below to make it work:

“echo y | /opt/lotus/bin/java -cp /opt/lotus/notes/latest/ibmpow/dconsole.jar lotus.domino.console.DominoController -q”

You have to give the installed directory instead of /opt/lotus, if /opt/lotus is not where you installed or /opt/lotus link is not set to the installed directory.

NOTE: Control should be in Server Data Directoy before the above line is executed. In your script you should cd to before this line. Since this process outputs a status string continuously until server exits, you can redirect that to /dev/null.

Subject: It works!

Thank you both. I tried both suggestions and they actually both worked to stop the controller from a script.

I changed the line in the end to:

echo y | /opt/lotus/bin/java -cp /opt/lotus/notes/latest/ibmpow/dconsole.jar lotus.domino.console.DominoController -q -ip x.x.x.x

(the real IP nukber for the x’s), as I’m afraid that the line would otherwise stop all controllers on the partitioned server (couldn’t test that yet as there’s only one partition running for now).

I do get one error when using any of the suggested commands:

stty: tcgetattr: A specified file does not support the ioctl system call.

It doesn’t seem to affect the execution of the script, but does anyone know what might cause it?