Fix Problem running on OpenVZ #129 again
On Debian 9 the unit file openvpn-server@.service must use and modyfy for OpenVZ. The file openvpn@.service does not work.
This commit is contained in:
parent
3d075c8708
commit
c2353a6f6c
1 changed files with 15 additions and 1 deletions
|
|
@ -894,6 +894,19 @@ verb 3" >> /etc/openvpn/server.conf
|
|||
# This package uses a sysvinit service
|
||||
systemctl enable openvpn
|
||||
systemctl start openvpn
|
||||
elif [[ -f /lib/systemd/system/openvpn-server@.service ]]; then
|
||||
# On Debian 9, needs to copy from an other place
|
||||
# Don't modify package-provided service
|
||||
cp /lib/systemd/system/openvpn-server@.service /etc/systemd/system/openvpn-server@.service
|
||||
|
||||
# Workaround to fix OpenVPN service on OpenVZ
|
||||
sed -i 's|LimitNPROC|#LimitNPROC|' /etc/systemd/system/openvpn-server@.service
|
||||
# Another workaround to keep using /etc/openvpn/
|
||||
sed -i 's|/etc/openvpn/server|/etc/openvpn|' /etc/systemd/system/openvpn-server@.service
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl restart openvpn-server@server
|
||||
systemctl enable openvpn-server@server
|
||||
else
|
||||
# Don't modify package-provided service
|
||||
cp /lib/systemd/system/openvpn\@.service /etc/systemd/system/openvpn\@.service
|
||||
|
|
@ -1171,7 +1184,8 @@ function removeOpenVPN () {
|
|||
PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2)
|
||||
|
||||
# Stop OpenVPN
|
||||
if [[ "$OS" =~ (fedora|arch|centos) ]]; then
|
||||
if [[ -f /etc/systemd/system/openvpn-server@.service ]]; then
|
||||
# fedora, arch, centos, debian 9
|
||||
systemctl disable openvpn-server@server
|
||||
systemctl stop openvpn-server@server
|
||||
# Remove customised service
|
||||
|
|
|
|||
Loading…
Reference in a new issue