我有我的1989年Mac /30连接到我的Debian 10路由器使用PPP通过一个空调制解调器USB RS232适配器。
当我想连接时,我首先必须从另一台机器进入debian并运行
# pppd nodetach /dev/ttyUSB0 57600 -crtscts此外,如果Mac断开连接,那么pppd就退出,为了重新连接,我不得不再次做同样的事情。
是否有可能让pppd自动在ttyUSB0上收听?还有熬夜呢?
(我发现的所有文档都是为了将PPP用作拨号互联网连接的客户端,而不是作为服务器。)
mini31 # pwd
/etc/systemd/network
mini31 # ls -l
total 4
-rw-r--r-- 1 root root 187 Jun 14 12:12 pppd-ttyUSB0.service
mini31 # cat pppd-ttyUSB0.service
[Service]
ExecStart=/usr/sbin/pppd nodetach /dev/ttyUSB0 57600 -crtscts
Restart=always
RestartSec=0
[Unit]
Description=pppd on ttyUSB0 for SE/30
After=network.target
Wants=network.target
mini31 # systemctl status pppd-ttyUSB0
Unit pppd-ttyUSB0.service could not be found.
mini31 #看来/etc/systemd/system是唯一起作用的文件夹。
此外,你必须:
# systemctl daemon-reload
mini31 # systemctl status pppd-ttyUSB0
● pppd-ttyUSB0.service - pppd on ttyUSB0 for Macs
Loaded: loaded (/etc/systemd/system/pppd-ttyUSB0.service; static; vendor preset: enabled)
Active: inactive (dead)
mini31 # systemctl enable pppd-ttyUSB0
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
instance name specified.
mini31 # systemctl start pppd-ttyUSB0(不知道enable的那些胡说八道是什么意思。)
发布于 2021-06-14 11:04:49
创建运行此守护进程的服务。在systemd服务中,您可以使用Restart=选项在服务退出时再次自动启动它。
[Service]
ExecStart=-/usr/bin/pppd nodetach /dev/ttyUSB0 57600 -crtscts
Restart=always
RestartSec=0实际上,您的情况非常类似于getty@.service,只使用pppd而不是getty,后者通常在指定的tty处等待登录提示。因此,查看该单元以获得灵感可能是有用的--例如,您可能希望将它变成一个模板单元(名为pppd@,并使用/dev/%i作为设备路径);您可能希望在单元部分中包含Conflicts=getty@%i.service,等等。
(实际上,在“sysvinit”环境中,我建议为pppd创建一个/etc/inittab条目,这样init就会像getty一样自动重新启动它。)
https://unix.stackexchange.com/questions/654175
复制相似问题