Skip to content

Commit

Permalink
Fix Problem running on OpenVZ angristan#129 again
Browse files Browse the repository at this point in the history
On Debian 9 the unit file openvpn-server@.service must use and modyfy for OpenVZ. The file openvpn@.service does not work.
  • Loading branch information
HenryNe committed Mar 26, 2020
1 parent 3d075c8 commit c2353a6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion openvpn-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c2353a6

Please sign in to comment.