chris@1: #!/bin/bash chris@1: chris@1: CLASSPATH=/usr/share/java/sonews.jar:\ chris@3: /usr/share/java/sonews-helpers.jar:\ chris@1: /usr/share/java/mysql-connector-java.jar:\ chris@1: /usr/share/java/glassfish-mail.jar:\ chris@1: /usr/share/java/postgresql.jar chris@1: chris@1: LOGFILE=/var/log/sonews.log chris@1: PIDFILE=/var/run/sonews.pid chris@1: ARGS="-mlgw -c /etc/sonews/sonews.conf -feed" chris@1: chris@3: MAINCLASS=org.sonews.Main chris@1: JAVA=java chris@1: chris@1: case "$1" in chris@1: start) chris@1: echo "Starting sonews Newsserver..." chris@1: $JAVA -classpath $CLASSPATH $MAINCLASS $ARGS &> $LOGFILE & chris@1: PID=$! chris@1: echo $PID > $PIDFILE chris@1: ;; chris@1: stop) chris@1: echo "Stopping sonews Newsserver..." chris@1: PID=`cat $PIDFILE` chris@1: STOPRES=0 chris@1: while [ $STOPRES -le 0 ] chris@1: do chris@1: kill -15 $PID &> /dev/null chris@1: STOPRES=$? chris@1: sleep 1 chris@1: done chris@1: echo "done." chris@1: ;; chris@3: restart) chris@3: $0 stop && $0 start chris@3: ;; chris@1: setup) chris@1: $JAVA -classpath $CLASSPATH org.sonews.util.DatabaseSetup chris@1: ;; chris@1: purge) chris@1: $JAVA -classpath $CLASSPATH org.sonews.util.Purger chris@1: ;; chris@3: version) chris@3: $JAVA -classpath $CLASSPATH $MAINCLASS -version chris@3: ;; chris@1: *) chris@1: echo "Usage: sonews [start|stop|restart|setup|purge]" chris@1: esac