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.
chris@1
     1
#!/bin/bash
chris@1
     2
SCRIPTROOT=$(pwd)
chris@1
     3
CLASSPATH=$SCRIPTROOT/lib/sonews.jar:\
chris@3
     4
$SCRIPTROOT/lib/sonews-helpers.jar:\
chris@1
     5
$SCRIPTROOT/lib/mysql-connector-java.jar:\
chris@1
     6
$SCRIPTROOT/lib/glassfish-mail.jar:\
chris@1
     7
$SCRIPTROOT/lib/postgresql.jar
chris@1
     8
chris@1
     9
LOGFILE=sonews.log
chris@1
    10
PIDFILE=sonews.pid
chris@1
    11
ARGS=$@
chris@1
    12
chris@1
    13
MAINCLASS=org.sonews.daemon.Main
chris@1
    14
JAVA=java
chris@1
    15
chris@1
    16
case "$1" in
chris@1
    17
  start)
chris@1
    18
    echo "Starting sonews Newsserver..."
chris@1
    19
    $JAVA -classpath $CLASSPATH $MAINCLASS $ARGS &> $LOGFILE &
chris@1
    20
    echo $! > $PIDFILE
chris@1
    21
    ;;
chris@1
    22
  stop)
chris@1
    23
    echo "Stopping sonews Newsserver..."
chris@1
    24
    PID=`cat $PIDFILE`
chris@1
    25
    kill -15 $PID
chris@1
    26
    ;;
chris@1
    27
  setup)
chris@1
    28
    $JAVA -classpath $CLASSPATH org.sonews.util.DatabaseSetup
chris@1
    29
    ;;
chris@1
    30
  purge)
chris@1
    31
    $JAVA -classpath $CLASSPATH org.sonews.util.Purger
chris@1
    32
    ;;
chris@1
    33
chris@1
    34
  *)
chris@1
    35
    echo "Usage: sonews [start|stop|setup|purge]"
chris@1
    36
esac