diff --git a/README.md b/README.md index eb736be..59a41fb 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,15 @@ # MineCartD -A Linux daemon for managing Minecraft servers +A Linux daemon for managing Minecraft servers +by CsokiCraft + + +## Installation +Run the `minecartd_install` script. It downloads and installs `minecartd`, sets up a new user account, generates default config file and servers directory, and installs and enables a `systemd` service for `minecartd`. +In general, using the service is the preferred method. However, on systems without `systemd`, or when testing the software, you may opt to disable it (`systemctl stop minecartd && systemctl disable minecartd`) and use the command line instead (`/usr/bin/minecartd` or `java -jar minecartd.jar`). ## Usage -On the server, run `minecartd`. +On the server, run `minecartd`, either from command line or via `systemd` service. Then on the client, connect to it with an appropriate tool (ex. `telnet`) to access the Command Interface @@ -18,7 +24,7 @@ The config file consists of `key=value` pairs. Lines starting with `#` won't be ### Command-line parameters * `--cfgfile|-f `: use this config file instead of `/etc/minecartd.conf` * `--gen-cfg|-C`: generate config and quit. Won't launch Command Interface. Can't be used with `-S` -* `--stop|-S`: connect to a server on localhost and send STOP to it (stops all Minecraft servers and the `minecartd` host). Can't be used with `-C` +* `--stop|-S`: connect to a server on `localhost` and send `STOP` to it (stops all Minecraft servers and the `minecartd` host). Can't be used with `-C` ## Using the Command Interface on the client diff --git a/src/rsrc/minecartd_install b/src/rsrc/minecartd_install new file mode 100644 index 0000000..122a9ad --- /dev/null +++ b/src/rsrc/minecartd_install @@ -0,0 +1,63 @@ +#!/bin/sh + +if [ $(id -u) != 0 ]; then + echo "You must run this script as root!" >&2 + exit 1 +fi + +# Add user and working directory +useradd -U -r -d /var/lib/minecartd -m minecartd + +# Download JAR +wget -O /usr/lib/minecartd.jar http://csokicraft.agyklub.hu/downloads?file=minecartd_1.0.jar + +# Add runscript +cat > /usr/bin/minecartd <<'EOF' +#!/bin/sh +java -jar /usr/lib/minecartd.jar "$@" +EOF +chmod 655 /usr/bin/minecartd + +# Create config (using newly created runscript) while we're root +/usr/bin/minecartd -C + +# Add systemd service entry +cat > /etc/systemd/system/minecartd.service < /usr/bin/minecartd_uninstall <