Fix systemd service on OpenVZ

fix the service on all systemd/ubuntu versions
This commit is contained in:
Angristan 2017-11-28 22:14:27 +01:00 committed by GitHub
parent 0a7ff64549
commit 1241072bb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -604,17 +604,13 @@ verb 3" >> /etc/openvpn/server.conf
if [[ "$OS" = 'debian' ]]; then if [[ "$OS" = 'debian' ]]; then
# Little hack to check for systemd # Little hack to check for systemd
if pgrep systemd-journal; then if pgrep systemd-journal; then
if [[ "$VERSION_ID" = 'VERSION_ID="9"' ]]; then #Workaround to fix OpenVPN service on OpenVZ
#Workaround to fix OpenVPN service on Debian 9 OpenVZ sed -i 's|LimitNPROC|#LimitNPROC|' /lib/systemd/system/openvpn\@.service
sed -i 's|LimitNPROC|#LimitNPROC|' /lib/systemd/system/openvpn-server\@.service sed -i 's|/etc/openvpn/server|/etc/openvpn|' /lib/systemd/system/openvpn\@.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\@.service
sed -i 's|%i.conf|server.conf|' /lib/systemd/system/openvpn-server\@.service
systemctl daemon-reload systemctl daemon-reload
systemctl restart openvpn-server@openvpn.service systemctl restart openvpn
systemctl enable openvpn-server@openvpn.service systemctl enable openvpn
else
systemctl restart openvpn@server.service
fi
else else
/etc/init.d/openvpn restart /etc/init.d/openvpn restart
fi fi
@ -681,4 +677,4 @@ verb 3" >> /etc/openvpn/client-template.txt
echo "Your client config is available at $homeDir/$CLIENT.ovpn" 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!" echo "If you want to add more clients, you simply need to run this script another time!"
fi fi
exit 0; exit 0;