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