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