minecraftctl

Allows running Minecraft server in background (daemon) and send commands, stop, start etc. with minecraftctl command.

Usage

Launch Minecraft server with:

$ minecraftctlserver <path to minecraft server install dir>

And control it with ‘minecraftctl’, for help try:

$ minecraftctl /

Executing console commands:

$ minecraftctl /server console help
$ minecraftctl /server console say hello world
$ minecraftctl /server console list
$ minecraftctl /server console kick kazuya

Stopping and starting minecraft server:s

$ minecraftctl /server stop
$ minecraftctl /server start

Shutting down minecraftctlserver and minecraft server within:

$ minecraftctl / shutdown

API

The minecraftctlserver exposes HTTP API on port 25560 (by default) and on localhost (by default). GET call will return a value for given URI or available API commands for GET / and /server. Use space delimited list of arguments as POST data. First argument will be threated as API command.

Some cURL examples:

$ curl localhost:25560/ # GET / give list of all API calls
$ curl localhost:25560/pid_file # get PID file location
$ curl localhost:25560/ -d shutdown # POST / with shutdown POST data will stop the control server
$ curl localhost:25560/status # get minecraft server status
$ curl localhost:25560/server -d 'stop' # stop minecraft server
$ curl localhost:25560/server -d 'start' # stop minecraft server
$ curl localhost:25560/server -d 'console list' # list all connected users

Changelog

v2.0.2

  • better help message and switch related error handling

v2.0.1

  • increased startup and command timeout

  • startup and command timeout values are now configurable via -t and -s switches

  • minecraftctl will not rise exception when command does not start with /

  • initial minecraft server startup will now be logged

  • shutdown messages logged in real time

v2.0.0

  • New cleaner API - more REST like

  • New API commands: pid, pid_file, dir, out…

  • Cleanups and fixes

v1.1.0

  • Output from server is streamed in real time

  • Fixed problem with initial pid file creation

  • Massive refactoring and tests

  • Added ‘status’ command

  • Better error detection and reporting

Contributing to minecraftctl

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Jakub Pastuszek. See LICENSE.txt for further details.