bin/sonews.sh
author cli
Sun, 29 Aug 2010 17:28:58 +0200
changeset 35 ed84c8bdd87b
parent 32 3af4237e4a15
child 76 b5690fc25af6
permissions -rwxr-xr-x
Moving source files into src/-subdir.
     1 #!/bin/bash
     2 cd `dirname $0`/..
     3 NEWSROOT=`pwd`
     4 CLASSPATH=$NEWSROOT/lib/sonews.jar:\
     5 $NEWSROOT/lib/sonews-helpers.jar:\
     6 $NEWSROOT/lib/mysql-connector-java.jar:\
     7 $NEWSROOT/lib/glassfish-mail.jar:\
     8 $NEWSROOT/lib/postgresql.jar
     9 
    10 LOGFILE=/var/log/sonews.log
    11 PIDFILE=/var/pid/sonews.pid
    12 ARGS=$@
    13 
    14 MAINCLASS=org.sonews.Main
    15 JAVA=$JAVA_HOME/bin/java
    16 
    17 case "$1" in
    18   start)
    19     echo "Starting sonews Newsserver..."
    20     $JAVA -classpath $CLASSPATH $MAINCLASS $ARGS &> $LOGFILE &
    21     echo $! > $PIDFILE
    22     ;;
    23   stop)
    24     echo "Stopping sonews Newsserver..."
    25     PID=`cat $PIDFILE`
    26     kill -15 $PID
    27     ;;
    28   setup)
    29     $JAVA -classpath $CLASSPATH org.sonews.util.DatabaseSetup
    30     ;;
    31   purge)
    32     $JAVA -classpath $CLASSPATH org.sonews.util.Purger
    33     ;;
    34 
    35   *)
    36     echo "Usage: sonews [start|stop|setup|purge]"
    37 esac