author | cli |
Sat May 01 18:51:57 2010 +0200 (2010-05-01) | |
changeset 29 | 60c237bb677a |
parent 1 | 6fceb66e1ad7 |
permissions | -rwxr-xr-x |
chris@1 | 1 |
#!/bin/bash |
chris@1 | 2 |
|
chris@1 | 3 |
CLASSPATH=/usr/share/java/sonews.jar:\ |
chris@3 | 4 |
/usr/share/java/sonews-helpers.jar:\ |
chris@1 | 5 |
/usr/share/java/mysql-connector-java.jar:\ |
chris@1 | 6 |
/usr/share/java/glassfish-mail.jar:\ |
chris@1 | 7 |
/usr/share/java/postgresql.jar |
chris@1 | 8 |
|
chris@1 | 9 |
LOGFILE=/var/log/sonews.log |
chris@1 | 10 |
PIDFILE=/var/run/sonews.pid |
chris@1 | 11 |
ARGS="-mlgw -c /etc/sonews/sonews.conf -feed" |
chris@1 | 12 |
|
chris@3 | 13 |
MAINCLASS=org.sonews.Main |
chris@1 | 14 |
JAVA=java |
chris@1 | 15 |
|
chris@1 | 16 |
case "$1" in |
chris@1 | 17 |
start) |
chris@1 | 18 |
echo "Starting sonews Newsserver..." |
chris@1 | 19 |
$JAVA -classpath $CLASSPATH $MAINCLASS $ARGS &> $LOGFILE & |
chris@1 | 20 |
PID=$! |
chris@1 | 21 |
echo $PID > $PIDFILE |
chris@1 | 22 |
;; |
chris@1 | 23 |
stop) |
chris@1 | 24 |
echo "Stopping sonews Newsserver..." |
chris@1 | 25 |
PID=`cat $PIDFILE` |
chris@1 | 26 |
STOPRES=0 |
chris@1 | 27 |
while [ $STOPRES -le 0 ] |
chris@1 | 28 |
do |
chris@1 | 29 |
kill -15 $PID &> /dev/null |
chris@1 | 30 |
STOPRES=$? |
chris@1 | 31 |
sleep 1 |
chris@1 | 32 |
done |
chris@1 | 33 |
echo "done." |
chris@1 | 34 |
;; |
chris@3 | 35 |
restart) |
chris@3 | 36 |
$0 stop && $0 start |
chris@3 | 37 |
;; |
chris@1 | 38 |
setup) |
chris@1 | 39 |
$JAVA -classpath $CLASSPATH org.sonews.util.DatabaseSetup |
chris@1 | 40 |
;; |
chris@1 | 41 |
purge) |
chris@1 | 42 |
$JAVA -classpath $CLASSPATH org.sonews.util.Purger |
chris@1 | 43 |
;; |
chris@3 | 44 |
version) |
chris@3 | 45 |
$JAVA -classpath $CLASSPATH $MAINCLASS -version |
chris@3 | 46 |
;; |
chris@1 | 47 |
*) |
chris@1 | 48 |
echo "Usage: sonews [start|stop|restart|setup|purge]" |
chris@1 | 49 |
esac |