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