#!/bin/sh
# Adapt the following lines to your configuration
JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
HITCRYPTOPROXY_HOME=/usr/local/hitcryptoproxy
HITCRYPTOPROXY_USER=hitcryptoproxy
CLASSPATH=$HITCRYPTOPROXY_HOME/lib/hitcryptoproxy.jar:$HITCRYPTOPROXY_HOME/lib/commons-daemon-1.0.5.jar:$HITCRYPTOPROXY_HOME/lib/HitUpros.jar:$HITCRYPTOPROXY_HOME/lib/log4j-1.2.14.jar
HITCRYPTOPROXY_PID=$HITCRYPTOPROXY_HOME/logs/HITCRYPTOPROXY-daemon.pid
TMP_DIR=/var/tmp/
FILE_ENCODING=ISO-8859-1


case "$1" in
  start )
    shift
    $HITCRYPTOPROXY_HOME/bin/jsvc \
        -user $HITCRYPTOPROXY_USER \
        -home $JAVA_HOME \
        -cp $CLASSPATH -Djava.io.tmpdir=$TMP_DIR \
        -Dlog4j.configuration=file:///$HITCRYPTOPROXY_HOME/conf/log4j.properties \
        -Dfile.encoding=$FILE_ENCODING \
        -outfile $HITCRYPTOPROXY_HOME/logs/std_out.log \
        -errfile $HITCRYPTOPROXY_HOME/logs/std_err.log \
        -pidfile $HITCRYPTOPROXY_PID \
         de.karb.hitcryptoproxy.HitCryptoProxyServer $HITCRYPTOPROXY_HOME/conf/HitCryptoProxyServer.properties
    exit $?
    ;;
  stop )
    shift
    $HITCRYPTOPROXY_HOME/bin/jsvc \
        -verbose -user $HITCRYPTOPROXY_USER \
        -home $JAVA_HOME \
        -cp $CLASSPATH \
        -stop -Djava.io.tmpdir=$TMP_DIR \
        -Dlog4j.configuration=file:///$HITCRYPTOPROXY_HOME/conf/log4j.properties \
        -Dfile.encoding=$FILE_ENCODING \
        -outfile $HITCRYPTOPROXY_HOME/logs/std_out.log \
        -errfile $HITCRYPTOPROXY_HOME/logs/std_err.log \
        -pidfile $HITCRYPTOPROXY_PID \
         de.karb.hitcryptoproxy.HitCryptoProxyServer
    exit $?
    ;;
    * )
    echo "Usage $0 start | stop"
    exit 1
    ;;
esac
