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
chris@1
     1
#!/bin/bash
franta-hg@76
     2
franta-hg@76
     3
JAVA_HOME="/usr/lib/jvm/java-6-openjdk";
franta-hg@76
     4
NEWSROOT="/home/fiki/src/sonews-nntp/sonews-11-dev";
franta-hg@76
     5
bei@32
     6
cd `dirname $0`/..
bei@32
     7
NEWSROOT=`pwd`
franta-hg@76
     8
CLASSPATH=$NEWSROOT/build/sonews.jar:\
franta-hg@76
     9
$NEWSROOT/lib/commons-codec-1.5.jar:\
bei@32
    10
$NEWSROOT/lib/mysql-connector-java.jar:\
franta-hg@76
    11
$NEWSROOT/lib/javax.mail.jar:\
franta-hg@91
    12
$NEWSROOT/lib/saxon.jar:\
franta-hg@76
    13
$NEWSROOT/lib/postgresql-8.3-604.jdbc4.jar:\
franta-hg@76
    14
$NEWSROOT/lib/mysql-connector-java-5.1.7-bin.jar
chris@1
    15
franta-hg@91
    16
JAVA_OPTIONS="-Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl";
franta-hg@91
    17
franta-hg@76
    18
LOGFILE=var/log/sonews.log
franta-hg@76
    19
PIDFILE=var/pid/sonews.pid
chris@1
    20
ARGS=$@
chris@1
    21
franta-hg@76
    22
bei@32
    23
MAINCLASS=org.sonews.Main
bei@32
    24
JAVA=$JAVA_HOME/bin/java
chris@1
    25
chris@1
    26
case "$1" in
chris@1
    27
  start)
chris@1
    28
    echo "Starting sonews Newsserver..."
franta-hg@91
    29
    $JAVA $JAVA_OPTIONS -classpath $CLASSPATH $MAINCLASS $ARGS &> $LOGFILE &
chris@1
    30
    echo $! > $PIDFILE
chris@1
    31
    ;;
chris@1
    32
  stop)
chris@1
    33
    echo "Stopping sonews Newsserver..."
chris@1
    34
    PID=`cat $PIDFILE`
chris@1
    35
    kill -15 $PID
chris@1
    36
    ;;
chris@1
    37
  setup)
chris@1
    38
    $JAVA -classpath $CLASSPATH org.sonews.util.DatabaseSetup
chris@1
    39
    ;;
chris@1
    40
  purge)
chris@1
    41
    $JAVA -classpath $CLASSPATH org.sonews.util.Purger
chris@1
    42
    ;;
chris@1
    43
chris@1
    44
  *)
chris@1
    45
    echo "Usage: sonews [start|stop|setup|purge]"
chris@1
    46
esac