#!/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