bin/sonews.sh
author Christian Lins <christian@lins.me>
Wed, 14 Sep 2011 23:25:00 +0200
changeset 62 be4e87479855
parent 32 3af4237e4a15
child 76 b5690fc25af6
permissions -rwxr-xr-x
Reformatting XDaemonCommand
     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