bin/sonews.sh
author chris <chris@marvin>
Fri, 26 Jun 2009 16:48:50 +0200
changeset 1 6fceb66e1ad7
child 3 2fdc9cc89502
permissions -rwxr-xr-x
Hooray... sonews/0.5.0 final

HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Remove all lines to abort the collapse operation.
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