2021-05-13 07:35:00 +00:00
|
|
|
[Unit]
|
2021-06-17 02:49:01 +00:00
|
|
|
Description=Minecraft Server: %i
|
2021-05-13 07:35:00 +00:00
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=simple
|
2021-06-17 02:49:01 +00:00
|
|
|
WorkingDirectory={{ minecraft_home }}/%i
|
2021-05-13 07:35:00 +00:00
|
|
|
User={{ minecraft_user }}
|
|
|
|
Group={{ minecraft_user }}
|
|
|
|
Restart=always
|
2021-06-22 02:36:35 +00:00
|
|
|
EnvironmentFile={{ minecraft_home }}/%i/environment.conf
|
2021-05-13 07:35:00 +00:00
|
|
|
|
2021-06-17 02:49:01 +00:00
|
|
|
ExecStart=/usr/bin/screen -DmS minecraft-%i \
|
2021-06-22 02:36:35 +00:00
|
|
|
${JAVA_HOME}/bin/java -Xms${JAVA_XMS} -Xmx${JAVA_XMX} -jar minecraft_server.jar nogui
|
2021-06-17 02:49:01 +00:00
|
|
|
ExecReload=/usr/bin/screen -p 0 -S minecraft-%i -X eval 'stuff "reload"\\015'
|
|
|
|
ExecStop=/usr/bin/screen -p 0 -S minecraft-%i -X eval 'stuff "say SERVER SHUTDOWN IN 30 SECONDS"\015'
|
2021-05-13 07:35:00 +00:00
|
|
|
ExecStop=/bin/sleep 15
|
2021-06-17 02:49:01 +00:00
|
|
|
ExecStop=/usr/bin/screen -p 0 -S minecraft-%i -X eval 'stuff "say SERVER SHUTDOWN IN 15 SECONDS"\015'
|
2021-05-13 07:35:00 +00:00
|
|
|
ExecStop=/bin/sleep 10
|
2021-06-17 02:49:01 +00:00
|
|
|
ExecStop=/usr/bin/screen -p 0 -S minecraft-%i -X eval 'stuff "say SERVER SHUTDOWN IN 5 SECONDS"\015'
|
2021-05-13 07:35:00 +00:00
|
|
|
ExecStop=/bin/sleep 5
|
2021-06-17 02:49:01 +00:00
|
|
|
ExecStop=/usr/bin/screen -p 0 -S minecraft-%i -X eval 'stuff "save-all"\015'
|
2021-05-13 07:35:00 +00:00
|
|
|
ExecStop=/bin/sleep 1
|
2021-06-17 02:49:01 +00:00
|
|
|
ExecStop=/usr/bin/screen -p 0 -S minecraft-%i -X eval 'stuff "stop"\015'
|
2021-05-13 07:35:00 +00:00
|
|
|
ExecStop=/bin/sleep 3
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|