emsm.plugins.initd
¶
About¶
Works as interface between the linux initd service and the EMSM.
Download¶
You can find the latest version of this plugin in the EMSM GitHub repository.
Installation¶
You can use this plugin with initd or systemd.
initd (/etc/init.d/
)¶
You only have to create the init.d
script /etc/init.d/minecraft
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #!/bin/bash
### BEGIN INIT INFO
# Provides: EMSM - extendable minecraft server manager
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts and stops your minecraft worlds.
### END INIT INFO
EMSM=`which minecraft`
PLUGIN=initd
test -x $EMSM || exit 0
case "$1" in
start)
$EMSM $PLUGIN --start
;;
stop)
$EMSM $PLUGIN --stop
;;
restart)
$EMSM $PLUGIN --restart
;;
status)
$EMSM $PLUGIN --status
;;
*)
echo "Usage: $0 {start|stop|restart|status}" >&2
exit 1
;;
esac
|
$ sudo chmod +x /etc/init.d/minecraft
$ sudo update-rc.d minecraft defaults
$ sudo update-rc.d minecraft enable
systemd (/etc/systemd/system/minecraft.service
)¶
You only have to create the /etc/systemd/system/minecraft.service
file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | [Unit]
Description=Extendable Minecraft Server Manager (EMSM)
Requires=network.target
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/minecraft initd --start
ExecStop=/usr/bin/minecraft initd --stop
ExecReload=/usr/bin/minecraft initd --restart
[Install]
WantedBy=multi-user.target
|
$ sudo systemctl daemon-reload
$ sudo systemctl enable minecraft.service
Configuration¶
Arguments¶
-
--start
¶
Starts all worlds, where initd has been enabled in the
*.world.conf
configuration file.
-
--stop
¶
Stops all worlds, where initd is enabled. Note, that this will always force the stop of the world, since the process is killed anyway during system shutdown.
-
--restart
¶
Forces the restart of all worlds, for which initd has been enabled.
-
--status
¶
Prints the status (online/offline) for each initd enabled world.