From cf595eaee7741426a65f4915de72fcb3eadf0bc6 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Wed, 21 Jun 2017 00:02:03 -0500 Subject: [PATCH] Improve services on boot - Systemd may run rc.local early during system boot - Insert delay so that services can start correctly --- vpnsetup.sh | 6 ++---- vpnsetup_centos.sh | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/vpnsetup.sh b/vpnsetup.sh index ea5bb35..180f47d 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -432,14 +432,12 @@ if ! grep -qs "hwdsl2 VPN script" /etc/rc.local; then cat >> /etc/rc.local <<'EOF' # Added by hwdsl2 VPN script +(sleep 15 service ipsec start service xl2tpd start -echo 1 > /proc/sys/net/ipv4/ip_forward +echo 1 > /proc/sys/net/ipv4/ip_forward)& exit 0 EOF - if grep -qs raspbian /etc/os-release; then - sed --follow-symlinks -i '/hwdsl2 VPN script/a sleep 15' /etc/rc.local - fi fi bigecho "Starting services..." diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index 97a151a..15134a5 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -418,10 +418,11 @@ if ! grep -qs "hwdsl2 VPN script" /etc/rc.local; then cat >> /etc/rc.local <<'EOF' # Added by hwdsl2 VPN script +(sleep 15 modprobe -q pppol2tp service ipsec restart service xl2tpd restart -echo 1 > /proc/sys/net/ipv4/ip_forward +echo 1 > /proc/sys/net/ipv4/ip_forward)& EOF fi