7 # resolve links - $0 may be a softlink
10 while [ -h "$PRG" ]; do
12 link=`expr "$ls" : '.*-> \(.*\)$'`
13 if expr "$link" : '/.*' > /dev/null; then
16 PRG=`dirname "$PRG"`/"$link"
20 # Get standard environment variables
21 PRGDIR=`dirname "$PRG"`
23 # Only set CATALINA_HOME if not already set
24 [ -z "$AQUARIUM_HOME" ] && AQUARIUM_HOME=`cd "$PRGDIR/.." >/dev/null; pwd`
26 AQMAIN=gr.grnet.aquarium.Main
27 PID=$AQUARIUM_HOME/bin/aquarium.pid
28 LIB=$AQUARIUM_HOME/lib
29 LOG=$AQUARIUM_HOME/logs/aquarium.log
30 CONF=$AQUARIUM_HOME/conf
32 # Check the application status
36 aqrunning=`ps -ef|grep java|grep aquarium`
37 if [ -z "$aqrunning" ]; then
39 echo "Aquarium running, but no pid file found"
50 # Starts the application
53 if [ $? -ne 0 ] ; then
54 echo "Aquarium is running"
58 echo "Starting Aquarium"
61 CLASSPATH=`find $LIB -type f|grep jar$|tr '\n' ':'|sed -e 's/\:$//'`
63 # load log4j from classpath
64 CLASSPATH=$CONF:$CLASSPATH
67 PROPS="-Dlog4j.debug=true"
69 echo "Using AQUARIUM_HOME $AQUARIUM_HOME"
70 echo "Using CLASSPATH $CLASSPATH"
71 echo "Using configuration files in $CONF"
72 echo "Using MAIN $AQMAIN"
73 java -cp $CLASSPATH $PROPS $AQMAIN >> $LOG 2>&1 &
78 # Stops the application
81 if [ $? -eq 0 ] ; then
82 echo "Aquarium is not running"
86 # Kills the application process
87 echo -n "Stopping Aquarium: "
93 # Show the application status
96 if [ $? -ne 0 ] ; then
97 echo "Aquarium is running (pid=$pid)"
99 echo "Aquarium is stopped"
103 # Main logic, a simple case to call functions
119 echo "Usage: $0 {start|stop|restart|reload|status}"
125 # vim: set sta sts=4 shiftwidth=4 sw=4 et ai :