You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#! /bin/sh
# source: daemon.sh# Copyright Gerhard Rieger and contributors (see file CHANGES)# Published under the GNU General Public License V.2, see file COPYING
# This script assumes that you create group daemon1 and user daemon1 before.# they need only the right to exist (no login etc.)
# Note: this pid file mechanism is not robust!
# You will adapt these variablesUSER=daemon1GROUP=daemon1INIF=fwnonsec.domain.orgOUTIF=fwsec.domain.orgTARGET=w3.intra.domain.orgINPORT=80DSTPORT=80#INOPTS="fork,setgid=$GROUP,setuid=$USER"OUTOPTS=PIDFILE=/var/run/socat-$INPORT.pidOPTS="-d -d -lm" # notice to stderr, then to syslogSOCAT=/usr/local/bin/socat
if [ "$1" = "start" -o -z "$1" ]; then
$SOCAT $OPTS tcp-l:$INPORT,bind=$INIF,$INOPTS tcp:$TARGET:$DSTPORT,bind=$OUTIF,$OUTOPTS </dev/null & echo $! >$PIDFILE
elif [ "$1" = "stop" ]; then
/bin/kill $(/bin/cat $PIDFILE)fi
|