[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: TCP proxy for host on subnet



On Tue, Jun 06, 2017 at 05:39:19PM +0100, Ron Leach wrote:
> 2.  socat did not 'detach' from the keyboard session, so the screen 
> remained with a blank line and no shell prompt.  [This means that if I 
> invoke a solution this way, I will have to have a session running all 
> the time that I want socat to run.]

Excellent.  Services should be foreground processes, exactly like
this.  You're running it in a terminal now, because you're still in
the testing stages.

Once you're ready to deploy it, you would want to set it up as an
automatically respawning service, under systemd or one of the other
service managers.  E.g. under systemd, you'd create a file in
/etc/systemd/system/ with a name ending with .service and contents
something like this:

==============================================
[Unit]
Description=Your description
After=network.target

[Service]
ExecStart=/usr/bin/socat ...
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target
==============================================

Then "systemctl daemon-reload" and "systemctl enable yourservice.service"
and "systemctl start yourservice.service" and you're done.


Reply to: