nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #! /bin/sh |
2 | # source: daemon.sh |
||
3 | # Copyright Gerhard Rieger 2001 |
||
4 | # Published under the GNU General Public License V.2, see file COPYING |
||
5 | |||
6 | # This script assumes that you create group daemon1 and user daemon1 before. |
||
7 | # they need only the right to exist (no login etc.) |
||
8 | |||
9 | # Note: this pid file mechanism is not robust! |
||
10 | |||
11 | # You will adapt these variables |
||
12 | USER=daemon1 |
||
13 | GROUP=daemon1 |
||
14 | INIF=fwnonsec.domain.org |
||
15 | OUTIF=fwsec.domain.org |
||
16 | TARGET=w3.intra.domain.org |
||
17 | INPORT=80 |
||
18 | DSTPORT=80 |
||
19 | # |
||
20 | INOPTS="fork,setgid=$GROUP,setuid=$USER" |
||
21 | OUTOPTS= |
||
22 | PIDFILE=/var/run/socat-$INPORT.pid |
||
23 | OPTS="-d -d -lm" # notice to stderr, then to syslog |
||
24 | SOCAT=/usr/local/bin/socat |
||
25 | |||
26 | if [ "$1" = "start" -o -z "$1" ]; then |
||
27 | |||
28 | $SOCAT $OPTS tcp-l:$INPORT,bind=$INIF,$INOPTS tcp:$TARGET:$DSTPORT,bind=$OUTIF,$OUTOPTS </dev/null & |
||
29 | echo $! >$PIDFILE |
||
30 | |||
31 | elif [ "$1" = "stop" ]; then |
||
32 | |||
33 | /bin/kill $(/bin/cat $PIDFILE) |
||
34 | fi |