learning_record_doc/apps/openvpn/linux开机自启.md
2024-01-07 21:16:25 +08:00

384 B

sudo vim /usr/lib/systemd/system/openvpnclient.service

[Unit]
Description=OpenVPNClient

[Service]
Type=simple
ExecStart=openvpn /etc/openvpn/client/server001.ovpn
ExecStop=/usr/bin/killall openvpn
Restart=always
User=root

[Install]
WantedBy=multi-user.target


##刷新
sudo systemctl daemon-reload

#开启开机重启
sudo systemctl enable openvpnclient.service