Skip to content

Commit 53bcb39

Browse files
committed
Added [email protected] template for starting individual servers as systemd units.
1 parent ee00f9a commit 53bcb39

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ MSCTL := /usr/local/bin/msctl
55
MSCS := /usr/local/bin/mscs
66
MSCS_INIT_D := /etc/init.d/mscs
77
MSCS_SERVICE := /etc/systemd/system/mscs.service
8+
MSCS_SERVICE_TEMPLATE := /etc/systemd/system/[email protected]
89
MSCS_COMPLETION := /etc/bash_completion.d/mscs
910

1011
UPDATE_D := $(wildcard update.d/*)
@@ -28,6 +29,7 @@ update:
2829
install -m 0644 mscs.completion $(MSCS_COMPLETION)
2930
if which systemctl; then \
3031
install -m 0644 mscs.service $(MSCS_SERVICE); \
32+
install -m 0644 [email protected] $(MSCS_SERVICE_TEMPLATE); \
3133
fi
3234
@for script in $(UPDATE_D); do \
3335
sh $$script; \
@@ -36,7 +38,7 @@ update:
3638
clean:
3739
if which systemctl; then \
3840
systemctl -f disable mscs.service; \
39-
rm -f $(MSCS_SERVICE); \
41+
rm -f $(MSCS_SERVICE) $(MSCS_SERVICE_TEMPLATE); \
4042
else \
4143
update-rc.d mscs remove; \
4244
rm -f $(MSCS_INIT_D); \

[email protected]

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[Unit]
2+
Description=Minecraft Server Control Script for server %i
3+
Documentation=https://github.com/MinecraftServerControl/mscs
4+
Requires=network.target
5+
After=network.target
6+
7+
[Service]
8+
User=minecraft
9+
Group=minecraft
10+
Environment="PATH=/usr/local/bin:/usr/bin:/bin"
11+
ExecStart=/usr/local/bin/mscs start %i
12+
ExecStop=/usr/local/bin/mscs stop %i
13+
ExecReload=/usr/local/bin/mscs restart %i
14+
Type=oneshot
15+
RemainAfterExit=yes
16+
17+
[Install]
18+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)