exh*_*ris 6 server services systemd iperf
我希望无头服务器(运行 Ubuntu Server 19.10)不断侦听 iperf3 请求,即使在重新启动后也是如此。目前,我可以使用 -c 和 -d 标志在终端上运行它,将其作为守护进程运行(我认为这只是在后台运行)。
sudo iperf3 -s -D
Run Code Online (Sandbox Code Playgroud)
但我希望它在启动时始终以这种模式启动,因此它始终在后台监听。
以前做这种的时候,涉及到systemd,我对systemd不是太熟悉。我不认为当我阅读 iperf3 程序时提到了 systemd,那么它是否与其兼容(或者该声明本身是无意义的?)
之前在教程中只以非常有限的方式使用过 systemd,因此无法快速了解其范围。
ash*_*ama 13
由于Ubuntu似乎没有为iperf3d提供systemd服务,因此我们必须自己编写它。
请参阅https://gist.github.com/auipga/64be019018ef311deba2211ced316f5e,我也会在这里引用它。
[Unit]
Description=iperf3 server
After=syslog.target network.target auditd.service
[Service]
ExecStart=/usr/bin/iperf3 -s
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
将此文件放入/etc/systemd/system/iperf3.service,然后sudo systemctl enable iperf3.
| 归档时间: |
|
| 查看次数: |
12021 次 |
| 最近记录: |