-
Notifications
You must be signed in to change notification settings - Fork 5
Home
clicraft is a command-line wrapper for operation and administration of a Minecraft or Bukkit server.
This program should work if you have the following:
- Linux
- BASH
- tmux
- The minecraft server jar, a drop-in replacement (e.g. bukkit), or a download utility (e.g. cURL)
If you have these requirements and it does not work for you, let me know, I probably forgot something. If have something close to this and it almost works, let me know, maybe I'll be able to add support for your setup.
Warning: Do NOT install or run this program as root!
To install, create an installation directory (referred to by $CLICRAFT from here on out) and copy the contents of src/ to that directory.
CLICRAFT=~/clicraft mkdir $CLICRAFT cp -r src/* $CLICRAFT
It may be useful to put the clicraft executable somewhere in your PATH. Probably the easies way to do this is to symlink the executable from a directory in your PATH:
cd ~/bin ln -s $CLICRAFT/bin/clicraft
Once you've followed one of the instructions above, you should be able to get usage info using
clicraft help
To configure the server, copy the default config file found in $CLICRAFT/etc to $CLICRAFT/etc/clicraft.conf and edit to taste
cp $CLICRAFT/etc/clicraft-defaults.conf $CLICRAFT/etc/clicraft.conf vim $CLICRAFT/etc/clicraft.conf
You can extend clicraft's functionality by writing your own action scripts. These are simple scripts written in BASH that get executed from within clicraft, giving you access to clicraft's internal functions and variables, including those defined in etc/clicraft.conf.
Clicraft's internal action scripts are located in lib/action.d/. To define your own script, give it a .sh extension and place it in etc/action.d/ so it won't get overwritten when upgrading clicraft. A typical action script saved as etc/action.d/foo.sh might look like this:
#!bash
#
# Usage: clicraft foo
#
# Stops the server if it's running, or prints 'foo' if it's not.
#
if status; then
action stop
else
msg "foo"
fi
In this script, the 'Usage: ...' comment marks the beginning of the action's usage message.
This message will be displayed when invoking clicraft help foo
.
"status", "action", and "msg" are all functions internal to clicraft. You can see their declaration in lib/functions.sh.