29 lines
1.0 KiB
Django/Jinja
29 lines
1.0 KiB
Django/Jinja
[Unit]
|
|
Description=Minecraft Server: %i
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
WorkingDirectory={{ minecraft_home }}/%i
|
|
User={{ minecraft_user }}
|
|
Group={{ minecraft_user }}
|
|
Restart=always
|
|
EnvironmentFile={{ minecraft_home }}/%i/environment.conf
|
|
|
|
ExecStart=/usr/bin/screen -DmS minecraft-%i \
|
|
${JAVA_HOME}/bin/java -Xms${JAVA_XMS} -Xmx${JAVA_XMX} -jar minecraft_server.jar nogui
|
|
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'
|
|
ExecStop=/bin/sleep 15
|
|
ExecStop=/usr/bin/screen -p 0 -S minecraft-%i -X eval 'stuff "say SERVER SHUTDOWN IN 15 SECONDS"\015'
|
|
ExecStop=/bin/sleep 10
|
|
ExecStop=/usr/bin/screen -p 0 -S minecraft-%i -X eval 'stuff "say SERVER SHUTDOWN IN 5 SECONDS"\015'
|
|
ExecStop=/bin/sleep 5
|
|
ExecStop=/usr/bin/screen -p 0 -S minecraft-%i -X eval 'stuff "save-all"\015'
|
|
ExecStop=/bin/sleep 1
|
|
ExecStop=/usr/bin/screen -p 0 -S minecraft-%i -X eval 'stuff "stop"\015'
|
|
ExecStop=/bin/sleep 3
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|