当我在 Debian 系统上去使用 OpenVPN 的时候
感觉有些不习惯
之前是用的红帽系的操作系统
在使用 openvpn 的时候发现有些不同
最大的不同就是使用 systemd 去管理 openvpn 的时候
我去执行 systemctl start openvpn 这个服务的时候
居然没有任何反应
看状态显示 active(exited)我就感觉有些不对劲
于是我开始去查看 openvpn 的 service 文件
他是这样子的
$ cat /lib/systemd/system/openvpn.service
# This service is actually a systemd target,
# but we are using a service since targets cannot be reloaded.
[Unit]
Description=OpenVPN service
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecReload=/bin/true
WorkingDirectory=/etc/openvpn
[Install]
WantedBy=multi-user.target
/bin/ture 这个启动命令肯定是不对的
于是我开始查询相关信息
我发现不只是我意识到这个是不对的
我还发现了几个外国人发帖去询问这些东西
最后终于发现
是 openvpn 默认没有启用 systemd 的管理
如何启用:
设置 AUTOSTART="none"
在/etc/default/openvpn
sudo systemctl daemon-reload
正文完