From 9ea6cbe6c46a9b39c2dc8cf6a2de812eaee8c4d3 Mon Sep 17 00:00:00 2001 From: simono41 Date: Mon, 13 Nov 2017 08:02:30 -0500 Subject: [PATCH] fix --- openvpn-install.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 6426edf..0d4ab68 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -606,15 +606,24 @@ 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"' ]] || [[ "$VERSION_ID" = 'VERSION_ID="16.04"' ]]; 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|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 systemctl daemon-reload systemctl restart openvpn-server@openvpn.service systemctl enable openvpn-server@openvpn.service - else + elif [[ "$VERSION_ID" = 'VERSION_ID="16.04"' ]]; then +#The file is in a other dir +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-serve\@openvpn.service + systemctl enable openvpn-server@openvpn.service + +else systemctl restart openvpn@server.service fi else @@ -622,11 +631,11 @@ verb 3" >> /etc/openvpn/server.conf fi else if pgrep systemd-journal; then - if [[ "$OS" = 'arch' ]]; then + if [[ "$OS" = 'arch' ]] || [[ "$VERSION_ID" = 'VERSION_ID="16.04"' ]]; then #Workaround to avoid rewriting the entire script for Arch - sed -i 's|LimitNPROC|#LimitNPROC|' /lib/systemd/system/openvpn-server\@.service - sed -i 's|/etc/openvpn/server|/etc/openvpn|' /usr/lib/systemd/system/openvpn-server@.service - sed -i 's|%i.conf|server.conf|' /usr/lib/systemd/system/openvpn-server@.service + sed -i 's|LimitNPROC|#LimitNPROC|' /usr/lib/systemd/system/openvpn-server\@.service + sed -i 's|/etc/openvpn/server|/etc/openvpn|' /usr/lib/systemd/system/openvpn-server\@.service + sed -i 's|%i.conf|server.conf|' /usr/lib/systemd/system/openvpn-server\@.service systemctl daemon-reload systemctl restart openvpn-server@openvpn.service systemctl enable openvpn-server@openvpn.service