diff -r f907866f0e4b -r 6fceb66e1ad7 helpers/sonews --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/helpers/sonews Fri Jun 26 16:48:50 2009 +0200 @@ -0,0 +1,42 @@ +#!/bin/bash + +CLASSPATH=/usr/share/java/sonews.jar:\ +/usr/share/java/mysql-connector-java.jar:\ +/usr/share/java/glassfish-mail.jar:\ +/usr/share/java/postgresql.jar + +LOGFILE=/var/log/sonews.log +PIDFILE=/var/run/sonews.pid +ARGS="-mlgw -c /etc/sonews/sonews.conf -feed" + +MAINCLASS=org.sonews.daemon.Main +JAVA=java + +case "$1" in + start) + echo "Starting sonews Newsserver..." + $JAVA -classpath $CLASSPATH $MAINCLASS $ARGS &> $LOGFILE & + PID=$! + echo $PID > $PIDFILE + ;; + stop) + echo "Stopping sonews Newsserver..." + PID=`cat $PIDFILE` + STOPRES=0 + while [ $STOPRES -le 0 ] + do + kill -15 $PID &> /dev/null + STOPRES=$? + sleep 1 + done + echo "done." + ;; + setup) + $JAVA -classpath $CLASSPATH org.sonews.util.DatabaseSetup + ;; + purge) + $JAVA -classpath $CLASSPATH org.sonews.util.Purger + ;; + *) + echo "Usage: sonews [start|stop|restart|setup|purge]" +esac