helpers/sonews
changeset 2 1090e2141798
child 3 2fdc9cc89502
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/helpers/sonews	Wed Jul 01 10:48:22 2009 +0200
     1.3 @@ -0,0 +1,42 @@
     1.4 +#!/bin/bash
     1.5 +
     1.6 +CLASSPATH=/usr/share/java/sonews.jar:\
     1.7 +/usr/share/java/mysql-connector-java.jar:\
     1.8 +/usr/share/java/glassfish-mail.jar:\
     1.9 +/usr/share/java/postgresql.jar
    1.10 +
    1.11 +LOGFILE=/var/log/sonews.log
    1.12 +PIDFILE=/var/run/sonews.pid
    1.13 +ARGS="-mlgw -c /etc/sonews/sonews.conf -feed"
    1.14 +
    1.15 +MAINCLASS=org.sonews.daemon.Main
    1.16 +JAVA=java
    1.17 +
    1.18 +case "$1" in
    1.19 +  start)
    1.20 +    echo "Starting sonews Newsserver..."
    1.21 +    $JAVA -classpath $CLASSPATH $MAINCLASS $ARGS &> $LOGFILE &
    1.22 +    PID=$!
    1.23 +    echo $PID > $PIDFILE
    1.24 +    ;;
    1.25 +  stop)
    1.26 +    echo "Stopping sonews Newsserver..."
    1.27 +    PID=`cat $PIDFILE`
    1.28 +    STOPRES=0
    1.29 +    while [ $STOPRES -le 0 ]
    1.30 +    do
    1.31 +      kill -15 $PID &> /dev/null
    1.32 +      STOPRES=$?
    1.33 +      sleep 1
    1.34 +    done
    1.35 +    echo "done."
    1.36 +    ;;
    1.37 +  setup)
    1.38 +    $JAVA -classpath $CLASSPATH org.sonews.util.DatabaseSetup
    1.39 +    ;;
    1.40 +  purge)
    1.41 +    $JAVA -classpath $CLASSPATH org.sonews.util.Purger
    1.42 +    ;;
    1.43 +  *)
    1.44 +    echo "Usage: sonews [start|stop|restart|setup|purge]"
    1.45 +esac