Overview

Home tmade.de

Home Wiki

Pen

http://siag.nu/pen/howto.shtml

Init-script-example:

#!/bin/sh
#
# startup script for pen
#

PENBIN=/usr/local/bin/pen
LOGFILE=/var/log/pen_ws_all_80_443.log
PIDFILE1=/var/run/pen_ws1_80.pid
PIDFILE2=/var/run/pen_ws2_80.pid
TIMEOUT=14400
CONTROLPORT=8812
CHROOTDIR=/chroot/pen

LBSERVER1=10.6.3.52:80
LBSERVER2=10.6.3.53:80
LBSERVER3=10.6.3.54:80
LBSERVER11=10.6.3.52:443
LBSERVER22=10.6.3.53:443
LBSERVER33=10.6.3.54:443

SERVER1=10.6.11.23:80
SERVER2=10.6.11.23:443

case "$1" in

    start)
    if [ -x "$PENBIN" ] ; then
        echo -n "Starting pen: "
        $PENBIN -T $TIMEOUT -C $CONTROLPORT -S 2 -X -l $LOGFILE -p $PIDFILE1 $LBSERVER1 $SERVER1 $SERVER2
        $PENBIN -T $TIMEOUT -C $CONTROLPORT -S 2 -X -l $LOGFILE -p $PIDFILE11 $LBSERVER11 $SERVER1 $SERVER2
        echo -e "OK"
        exit
    fi
    ;;

    stop)
    echo -n "Stopping pen: "
    kill `cat $PIDFILE1`
    kill `cat $PIDFILE11`
    echo -e "OK"
    exit
    ;;

    restart)
    $PENBIN stop
    $PENBIN start
    exit
    ;;

    status)
    if [ -f "$PIDFILE" ]; then
        read pen_pid < $PIDFILE
      if kill -0 "$pen_pid" 2>/dev/null ; then
        echo -e "PEN running ("$pen_pid")"
        exit
      else
        echo -e "PEN is not running, but PID file exists"
        exit 1
      fi
    else
        echo -e "PEN is not running"
        exit 1
      fi
    ;;


    *)
    echo "usage: $0 { start | stop | restart | status }" >&2
    exit 1
    ;;

esac