wiki:RunningEarthworm
Last modified 10 months ago Last modified on 10/11/16 15:57:40

Running Earthworm

The start of earthworm is a non-trivial matter... In a nutshell, you need to get all of your configuration (.d and .desc) files into a params directory, build a logs directory, and then set your environment and run startstop. The recommendation is to get a pre-working Earthworm parameter directory and get that going or run the Memphis Test (described in the EarthwormTest page).

Linux Startup of Earthworm

Traditionally users start earthworm by setting the environment in a shell file, sourcing that, then running startstop. When you want to have Earthworm run automatically in a production system, the process is a bit more involved. First get EW running as a Unix user you want it to run as and make sure you are happy with the location of all files (logs and params) and the environment is configured properly and all works. Next, you need to add a script to the /etc/init.d to help start earthworm when the machine reboots. Here is an example earthworm script to put into init.d. Call it 'earthworm':

#!/bin/sh
#chkconfig: 35 95 20
# description: This is the earthworm software start up script
# processname: earthworm

EW=/opt/earthworm
export CLASSPATH=:/opt/earthworm/Winston1.1/lib/winston.jar
export PYTHONPATH=:/usr/local/lib/python2.6:/var/python:/var/www:/var:/usr/share/python-support:/usr/local/lib/python2.6/site-packages:/opt/earthworm/ewfe/src

case "$1" in
        start)
                if [ ! -f $EW/start_earthworm.sh ]
                then
                        echo "earthworm startup: cannot find start script start_earthworm.sh"  > $EW/run_working/logs/start_earthworm.log 2>&1 &
                        exit
                fi
                su earthworm -c $EW/start_earthworm.sh > $EW/run_working/logs/start_earthworm.log 2>&1 &
                ;;
        stop)
                su earthworm -c $EW/active_ew/bin/pau
                ;;
        restart)
                $0 stop
                $0 start
                ;;
        *)
                echo "usage: start " # stop|start|restart"
                ;;
esac 

In the /opt/earthworm directory of the above example, we create the shell script start_earthworm.sh, shown below:

#!/bin/bash
# Start up earthworm in background
cd /opt/earthworm/active_ew
source /opt/earthworm/run_working/params/ew_linux.bash
startstop >& /opt/earthworm/run_working/logs/startstop.log &

Then use the Linux chkconfig program (see the manual page) to add it to runlevel 3 and 5. Ie: chkconfig --add earthworm