#!/bin/sh # # Start/Stop the JonDonym proxy daemonized ### BEGIN INIT INFO # Provides: jondo # Required-Start: $time $local_fs $remote_fs $network # Required-Stop: $network $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: GUI-less daemon for JonDonym ### END INIT INFO set -e # include LSB functions if [ -f /lib/lsb/init-functions ] ; then . /lib/lsb/init-functions fi DESC="JonDo daemon" NAME="jondodaemon" USER="jondo-daemon" GROUP="jondo-daemon" CONF="/etc/jondo/jondoconsole.conf" LOGFILE="/var/log/jondo/jondodaemon.log" CACHE="/var/cache/jondo/jondodaemon.sqlite" PIDFILE="/var/run/jondodaemon.pid" ENABLE_CONTROL_PORT="no" CONTROL=" " USE_PROXY="no" PROXY="" USE_PROXY_AUTH="no" PROXY_AUTH="" ENABLE_FORWARDER="no" FORWARDER="" ENABLE_JONDONYM="yes" JONDONYM="" LISTENER_ADDR=localhost LISTENER_PORT=4001 # Include the wrappers utility script and look for suitable JRE if [ -f /usr/lib/java-wrappers/java-wrappers.sh ] ; then . /usr/lib/java-wrappers/java-wrappers.sh else echo "Error: java-wrappers not found! Please install java-wrappers first." exit 1 fi find_java_runtime sun openjdk # Include the settings for the daemon if [ -f /etc/jondo/jondodaemon.conf ] ; then . /etc/jondo/jondodaemon.conf fi case $1 in start) if [ "$ENABLE_CONTROL_PORT" != "no" ]; then CONTROL="-d $CONTROL_LISTEN_ADDRESS:$CONTROL_LISTEN_PORT" fi if [ "$USE_PROXY" != "no" ]; then PROXY="-p $PROXY_HOST:$PROXY_PORT" fi if [ "$USE_PROXY_AUTH" != "no" ]; then PROXY_AUTH="-a $PROXY_USER:$PROXY_PASS" fi if [ "$ENABLE_FORWARDER" != "no" ]; then FORWARDER="-f $FORWARDER_LISTEN_PORT" fi if [ "$ENABLE_JONDONYM" != "yes" ]; then JONDONYM="--noJonDonymProxy" fi log_daemon_msg "Starting $DESC... " if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --make-pidfile --chuid $USER --group $GROUP --background --exec $JAVA_CMD -- -Djava.net.preferIPv4Stack=true -jar /usr/share/java/JonDoConsole.jar -c $CONF -l $LOGFILE -s $CACHE $CONTROL $PROXY $PROXY_AUTH $FORWARDER $JONDONYM -n $LISTENER_ADDR:$LISTENER_PORT ; then log_end_msg 0 else log_end_msg 1 fi ;; stop) log_daemon_msg "Stopping $DESC... " start-stop-daemon --stop --oknodo --pidfile $PIDFILE --exec $JAVA_CMD log_end_msg 0 ;; status) ret=0 status_of_proc -p $PIDFILE $JAVA_CMD 2>/dev/null || ret=$? ;; restart|reload|force-reload) $0 stop sleep 2 $0 start ;; -t|--daemonAuthentication|passwd) $JAVA_CMD -Djava.net.preferIPv4Stack=true -jar /usr/share/java/JonDoConsole.jar -c $CONF -t ;; *) echo "Usage: $0 start|stop|restart|status|passwd" >&2 exit 1 ;; esac exit 0