The author probably never tried it. The manual says this about the
After establishing a connection, handles its channel in a child process and keeps the parent process attempting to produce more connections, either by listening or by connecting in a loop (example).
socat will not fork before starting the main listen loop.
-d option just increases verbosity (as in
socat can’t do that.
The source tree contains this helper script to launch
socat in the background. You can adapt it to your purposes. I did not write this script!
# source: daemon.sh
# Copyright Gerhard Rieger 2001
# 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 variables
OPTS="-d -d -lm" # notice to stderr, then to syslog
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)