我正在尝试使用systemd服务文件连接到vpnc。服务文件运行脚本myscript.sh,该脚本除其他外运行:
sudo vpnc myhost
在启动设备时,其他命令已正确执行,但vpn未连接,并显示错误消息:
vpnc: unknown host `myhost.com'
但是,如果我使用手动运行服务文件,则>
systemctl start myservice.service
然后vpn成功启动。
我的服务文件如下:
[Unit] Description=VPN Start Wants=network-online.target After=network.target network-online.target [Service] Environment=DISPLAY=:0.0 Environment=XAUTHORITY=/home/pi/.Xauthority Type=forking ExecStart=/bin/bash /home/pi/myscript.sh Restart=on-abort User=pi Group=pi [Install] WantedBy=multi-user.target
systemctl status myservice.service
包括此消息:
pi: TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/usr/sbin/vpnc myhost
我已经完成:
systemctl enable systemd-networkd-wait-online
而且似乎没有帮助。
我正在尝试使用systemd服务文件连接到vpnc。服务文件运行脚本myscript.sh,该脚本除其他外运行:sudo vpnc myhost引导设备时,其他命令...
可能已经很晚了,但是也许其他人偶然发现了这个。