CESNET / UltraGrid

UltraGrid low-latency audio and video network transmission system
http://www.ultragrid.cz
Other
492 stars 53 forks source link

nat-helper only runs with stdin attached to a tty #253

Closed reduzent closed 1 year ago

reduzent commented 1 year ago

In other words, nat-helper cannot be easily run as a systemd service on Linux because of this. Normally, systemd connects the stdin of the program to /dev/null. However, nat-helper immediately exits when run as systemd service. You can emulate the systemd behavior when running nat-helper like this:

$ nat-helper -p 12777 < /dev/null 
Starting thread
Stopping...
Running
End

If there is no need to read something from stdin, nat-helper shouldn't care to what kind of stdin it is connected to. It should simply run.

As a work-ardound, this can be added to the systemd service unit file to make nat-helper run under systemd:

StandardInput=tty-force

(as documented here ).

BTW: this is the whole systemd service unit file I use for nat-helper:

[Unit]
Description=nat-helper for UltraGrid peer-to-peer connections
After=syslog.target

[Service]
Type=simple
ExecStart=/usr/local/bin/nat-helper
StandardInput=tty-force
User=nat-helper
Group=nat-helper

[Install]
WantedBy=multi-user.target
mpiatka commented 1 year ago

Thanks for reporting this. Should be fixed now in the current master branch.

reduzent commented 1 year ago

I confirm this issue is fixed. Many thanks!