#!/bin/csh

#############################################################################
# This script starts the Daylight Thor and Merlin servers, looking
# for and removing .LCK files if necessary, and loading the 
# specified databases into Merlin.  The file ".daylight" should
# exist and fully specify the necessary Daylight environment:
# DY_ROOT, DY_DATABASE_PATH, DY_THORDB, DY_LICENSEDATA, 
# DY_DATABASE_PASSWORDS_FILE, DY_MERLIN_SERVER_LIST,
# DY_THOR_LOG_FILE, DY_MERLIN_LOG_FILE, DY_MERLIN_MEMORY_LIMIT, etc.
# to list some of the most important.
# 
# (See also script KILL_DCIS_SERVERS.)
# 
# This startup script can be invoked automatically at boot time
# by creating a file /etc/rc2.d/S99Daylight containing the
# lines:
#        #!/bin/csh
#        su thor < /export/home/thor/START_DCIS_SERVERS
# where "thor" is the Daylight administrator.
#############################################################################

source /export/home/jj/.daylight
  
set LCK_FILES=`find $DY_DATABASE_PATH -name '*LCK' -print`
if ( "$LCK_FILES" != "" ) then
	echo "Removing Thor lockfiles..."
	rm -f $LCK_FILES
endif

setenv DATABASES "bugs medchem96demo acd951demo"

echo "Starting Thorserver..."
$DY_ROOT/bin/thorserver &
sleep 3

echo "Starting Merlinserver; Merlinloading <$DATABASES>..."
$DY_ROOT/bin/merlinserver $DATABASES &
sleep 3

echo "Starting Daytoolserver ..."
$DY_ROOT/bin/daytoolserver &
