bin/sonews.sh
author cli
Wed, 12 Aug 2009 17:25:46 +0200
changeset 10 cb071b654cf7
parent 3 2fdc9cc89502
child 32 3af4237e4a15
permissions -rwxr-xr-x
Skip comments in commands.list file.
     1 #!/bin/bash
     2 SCRIPTROOT=$(pwd)
     3 CLASSPATH=$SCRIPTROOT/lib/sonews.jar:\
     4 $SCRIPTROOT/lib/sonews-helpers.jar:\
     5 $SCRIPTROOT/lib/mysql-connector-java.jar:\
     6 $SCRIPTROOT/lib/glassfish-mail.jar:\
     7 $SCRIPTROOT/lib/postgresql.jar
     8 
     9 LOGFILE=sonews.log
    10 PIDFILE=sonews.pid
    11 ARGS=$@
    12 
    13 MAINCLASS=org.sonews.daemon.Main
    14 JAVA=java
    15 
    16 case "$1" in
    17   start)
    18     echo "Starting sonews Newsserver..."
    19     $JAVA -classpath $CLASSPATH $MAINCLASS $ARGS &> $LOGFILE &
    20     echo $! > $PIDFILE
    21     ;;
    22   stop)
    23     echo "Stopping sonews Newsserver..."
    24     PID=`cat $PIDFILE`
    25     kill -15 $PID
    26     ;;
    27   setup)
    28     $JAVA -classpath $CLASSPATH org.sonews.util.DatabaseSetup
    29     ;;
    30   purge)
    31     $JAVA -classpath $CLASSPATH org.sonews.util.Purger
    32     ;;
    33 
    34   *)
    35     echo "Usage: sonews [start|stop|setup|purge]"
    36 esac