From 1241072bb2dab385b742efab6b1501226ad19d75 Mon Sep 17 00:00:00 2001 From: Angristan Date: Tue, 28 Nov 2017 22:14:27 +0100 Subject: [PATCH] Fix systemd service on OpenVZ fix the service on all systemd/ubuntu versions --- openvpn-install.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index ba86428..d027572 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -604,17 +604,13 @@ verb 3" >> /etc/openvpn/server.conf if [[ "$OS" = 'debian' ]]; then # Little hack to check for systemd if pgrep systemd-journal; then - if [[ "$VERSION_ID" = 'VERSION_ID="9"' ]]; then - #Workaround to fix OpenVPN service on Debian 9 OpenVZ - sed -i 's|LimitNPROC|#LimitNPROC|' /lib/systemd/system/openvpn-server\@.service - sed -i 's|/etc/openvpn/server|/etc/openvpn|' /lib/systemd/system/openvpn-server\@.service - sed -i 's|%i.conf|server.conf|' /lib/systemd/system/openvpn-server\@.service + #Workaround to fix OpenVPN service on OpenVZ + sed -i 's|LimitNPROC|#LimitNPROC|' /lib/systemd/system/openvpn\@.service + sed -i 's|/etc/openvpn/server|/etc/openvpn|' /lib/systemd/system/openvpn\@.service + sed -i 's|%i.conf|server.conf|' /lib/systemd/system/openvpn\@.service systemctl daemon-reload - systemctl restart openvpn-server@openvpn.service - systemctl enable openvpn-server@openvpn.service - else - systemctl restart openvpn@server.service - fi + systemctl restart openvpn + systemctl enable openvpn else /etc/init.d/openvpn restart fi @@ -681,4 +677,4 @@ verb 3" >> /etc/openvpn/client-template.txt echo "Your client config is available at $homeDir/$CLIENT.ovpn" echo "If you want to add more clients, you simply need to run this script another time!" fi -exit 0; \ No newline at end of file +exit 0;