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