2023-09-19 17:40:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
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
|
|
|
|
|
2024-01-07 21:16:25 +08:00
|
|
|
#开启开机重启
|
|
|
|
sudo systemctl enable openvpnclient.service
|
2023-09-19 17:40:07 +08:00
|
|
|
|
|
|
|
```
|
|
|
|
|