From 2953ce49ec7edecbe3dd0dddad8009768b94a9b2 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Tue, 10 Mar 2020 06:00:34 +0100 Subject: [PATCH] No manual editing of service file requred. Start service after network. --- Makefile | 4 +++- sgs-xl.service | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index bdded0f..dd4a912 100644 --- a/Makefile +++ b/Makefile @@ -32,9 +32,11 @@ newhostfiles : /usr/bin/wget http://www.pistar.uk/downloads/DCS_Hosts.txt && sudo /bin/mv -f DCS_Hosts.txt $(CFGDIR) install : sgs-xl + /bin/mkdir -p $(CFGDIR) /bin/cp -f sgs-xl.cfg $(CFGDIR) /bin/cp -f sgs-xl $(BINDIR) /bin/cp -f sgs-xl.service /lib/systemd/system + /usr/bin/sed -i "s|REPLACEME|/usr/sbin/sgs-xl /etc/sgs-xl/sgs-xl.cfg|g" /lib/systemd/system/sgs-xl.service systemctl enable sgs-xl.service systemctl daemon-reload systemctl start sgs-xl.service @@ -45,7 +47,7 @@ uninstall : /bin/rm -f /lib/systemd/system/sgs-xl.service systemctl daemon-reload /bin/rm -f $(BINDIR)/sgs-xl - /bin/rm -f $(CFGDIR)/sgs-xl.cfg + /bin/rm -rf $(CFGDIR) removehostfiles : /bin/rm -f $(CFGDIR)/DExtra_Hosts.txt diff --git a/sgs-xl.service b/sgs-xl.service index ba13702..a750966 100644 --- a/sgs-xl.service +++ b/sgs-xl.service @@ -1,10 +1,11 @@ [Unit] Description=Smart Group Server -After=systemd-user-session.service +After=network-online.target +Wants=network-online.target [Service] Type=simple -ExecStart=/usr/local/bin/sgs /usr/local/etc/sgs.cfg +ExecStart=REPLACEME [Install] WantedBy=multi-user.target