bin/sonews.sh
author František Kučera <franta-hg@frantovo.cz>
Thu, 05 Jul 2012 13:19:19 +0200
changeset 119 f5b57e221e38
parent 91 70286a6cf338
permissions -rwxr-xr-x
mezery, tabulátory
     1 #!/bin/bash
     2 
     3 JAVA_HOME="/usr/lib/jvm/java-6-openjdk";
     4 NEWSROOT="/home/fiki/src/sonews-nntp/sonews-11-dev";
     5 
     6 cd `dirname $0`/..
     7 NEWSROOT=`pwd`
     8 CLASSPATH=$NEWSROOT/build/sonews.jar:\
     9 $NEWSROOT/lib/commons-codec-1.5.jar:\
    10 $NEWSROOT/lib/mysql-connector-java.jar:\
    11 $NEWSROOT/lib/javax.mail.jar:\
    12 $NEWSROOT/lib/saxon.jar:\
    13 $NEWSROOT/lib/postgresql-8.3-604.jdbc4.jar:\
    14 $NEWSROOT/lib/mysql-connector-java-5.1.7-bin.jar
    15 
    16 JAVA_OPTIONS="-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl";
    17 
    18 LOGFILE=var/log/sonews.log
    19 PIDFILE=var/pid/sonews.pid
    20 ARGS=$@
    21 
    22 
    23 MAINCLASS=org.sonews.Main
    24 JAVA=$JAVA_HOME/bin/java
    25 
    26 case "$1" in
    27   start)
    28     echo "Starting sonews Newsserver..."
    29     $JAVA $JAVA_OPTIONS -classpath $CLASSPATH $MAINCLASS $ARGS &> $LOGFILE &
    30     echo $! > $PIDFILE
    31     ;;
    32   stop)
    33     echo "Stopping sonews Newsserver..."
    34     PID=`cat $PIDFILE`
    35     kill -15 $PID
    36     ;;
    37   setup)
    38     $JAVA -classpath $CLASSPATH org.sonews.util.DatabaseSetup
    39     ;;
    40   purge)
    41     $JAVA -classpath $CLASSPATH org.sonews.util.Purger
    42     ;;
    43 
    44   *)
    45     echo "Usage: sonews [start|stop|setup|purge]"
    46 esac