Added mscs@.service template for starting individual servers as systemd units.

This commit is contained in:
Lane Shaw 2021-06-27 18:40:58 -04:00
parent ee00f9a5c8
commit 53bcb39a23
No known key found for this signature in database
GPG Key ID: A05FFEEE5D5BE647
2 changed files with 21 additions and 1 deletions

View File

@ -5,6 +5,7 @@ MSCTL := /usr/local/bin/msctl
MSCS := /usr/local/bin/mscs
MSCS_INIT_D := /etc/init.d/mscs
MSCS_SERVICE := /etc/systemd/system/mscs.service
MSCS_SERVICE_TEMPLATE := /etc/systemd/system/mscs@.service
MSCS_COMPLETION := /etc/bash_completion.d/mscs
UPDATE_D := $(wildcard update.d/*)
@ -28,6 +29,7 @@ update:
install -m 0644 mscs.completion $(MSCS_COMPLETION)
if which systemctl; then \
install -m 0644 mscs.service $(MSCS_SERVICE); \
install -m 0644 mscs@.service $(MSCS_SERVICE_TEMPLATE); \
fi
@for script in $(UPDATE_D); do \
sh $$script; \
@ -36,7 +38,7 @@ update:
clean:
if which systemctl; then \
systemctl -f disable mscs.service; \
rm -f $(MSCS_SERVICE); \
rm -f $(MSCS_SERVICE) $(MSCS_SERVICE_TEMPLATE); \
else \
update-rc.d mscs remove; \
rm -f $(MSCS_INIT_D); \

18
mscs@.service Normal file
View File

@ -0,0 +1,18 @@
[Unit]
Description=Minecraft Server Control Script for server %i
Documentation=https://github.com/MinecraftServerControl/mscs
Requires=network.target
After=network.target
[Service]
User=minecraft
Group=minecraft
Environment="PATH=/usr/local/bin:/usr/bin:/bin"
ExecStart=/usr/local/bin/mscs start %i
ExecStop=/usr/local/bin/mscs stop %i
ExecReload=/usr/local/bin/mscs restart %i
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target