helpers/sonews
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
Hooray... sonews/0.5.0 final

HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Remove all lines to abort the collapse operation.
     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