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