Synopsis

clicraft [options] <action> [args]

Description

Clicraft is a command-line wrapper for operation and administration of a minecraft-compatible server. It is written in bash(1) and uses tmux(1) or screen(1) to daemonize and communicate with the server process.

The action is an action to perform on the server, such as starting it, stopping it, or sending a command to the server console. Actions are implemented with action scripts, which can be provided by the clicraft package or written by the user. For more information on writing action scripts, see clicraft-actions(5). The actions that ship with a default clicraft install are described below.

Options

-c, --config=<config>

Use config as the configuration directory. For other methods of setting this directory, see clicraft.conf(5).

-x, --xtrace

Print all expanded bash commands run by action to stdout. This is accomplished by setting bash’s xtrace option, and is mainly useful for debugging actions scripts. See clicraft-actions(5) for more information on action scripts.

If this option is passed multiple times, xtrace is set as soon as the second option is encountered, which can be useful for debugging clicraft itself.

-h, --help

Display this help message and exit.

-V, --version

Output version information and exit.

Actions

cmd [-v|--verbose] [-q|--quiet] <command>

Sends command to the server console. If clicraft recognizes command, it will wait until the command finishes or CMD_TIMEOUT seconds, whichever comes first, before returning. Any leading occurences of CMD_LSTRIP are removed from the beginning of command before being sent to the server console.

With -v or --verbose, print SERVER_LOG to stdout. If clicraft recognizes the command, it will attempt to print until the command finishes. Otherwise, it will print for CMD_TIMEOUT seconds.

With -q or --quiet, suppress -v output.

See clicraft.conf(5) for a description of the CMD_TIMEOUT, CMD_LSTRIP, or SERVER_LOG options.

console

Attach to the server console. This places you in the multiplexer shell session that the server is running in. All normal multiplexer key-bindings (like Ctrl-b d or Ctrl-a d to detach) should work.

dl [version]

Downloads version version of the server jar file. If version is release or snapshot, the latest release or snapshot version is used. If no version is supplied on the command line, use SERVER_VERSION instead.

The jar file is downloaded from SERVER_URL and saved to location SERVER_JAR using DOWNLOAD_COMMAND. Any instances of the string %v in DOWNLOAD_COMMAND are substituted with version.

If SERVER_JAR already exists, it is backed up to SERVER_JAR.ccback before being overwritten, and restored from SERVER_JAR.ccback if the download fails.

For information regarding SERVER_VERSION, SERVER_URL, SERVER_JAR, and DOWNLOAD_COMMAND. see clicraft.conf(5).

edit [file|action]

Without file or action, edit clicraft.conf. If file exists in the server directory, edit it. If vinbt is installed, file has a .dat extension, and it exists in the world directory, edit file with vinbt. Otherwise, edit the action script for action. If the script does not already exist, create it with one of these templates:

  • $CLICRAFT_CONFIG/action.d/action.sh.example

  • $CLICRAFT_CONFIG/action.d/action.sh.example

  • $CLICRAFT_CONFIG/action.d/action-override.sh.example

See clicraft.conf(5) for a description of $CLICRAFT_CONFIG.

If the file is empty after editing, clicraft will delete it.

This command launches EDITOR to edit files, or vi(1) if the EDITOR variable is not defined in your environment.

enable [options] <action> [name]

Enables one of the example actions documented in clicraft-examples(1). If name is given, the new action script is enabled with that name.

Command line options:

-c, --copy

Copy the example action script. This ensures any local changes you make to the script are not overwritten when upgrading clicraft.

-s, --symlink

Symlink the example action script. This is the default, and ensures that changes in functionality are reflected in the enabled script when upgrading clicraft.

disable <action>

Disables an action script created by the user.

help [action]

Displays usage information for action. If no action is given, clicraft usage is displayed instead.

redb [operation] [args]

Manipulate the regex database. Exact usage depends on operation:

redb lookup <key>

Prints the regex for key from the regex database. If a regex for key does not exist, returns a nonzero exit status.

redb insert <key> <value>

Inserts a new key and value into the regex database. If a regex for key already exists, returns a nonzero exit status.

redb update <key> <value>

Changes the regex for key to value in the regex database. If a regex for key does not exist, returns a nonzero exit status.

redb delete <key>

Deletes the regex for key from the regex database. If a regex for key does not exist, returns a nonzero exit status.

If no operation or args are supplied, they are read from stdin.

restart [-w|--warn]

Restarts the server. With --warn, clicraft broadcasts a message in chat for 15 seconds to warn players that the server is being restarted.

start

Starts the server.

status

Reports on whether the server is running or not. If the server is not running, returns a nonzero exit status.

stop

Stops the server.

version

Prints version information.

Examples

clicraft cmd save-off

Prepare for a backup by disabling writes to the world files.

clicraft cmd save-on

Re-enable writes to the world files.

clicraft edit server.properties

Edit the server properties file.

clicraft edit level.dat

Edit the server’s level.dat file.

Configuration

See clicraft.conf(5) for details on configuring clicraft and clicraft-actions(5) for writing custom action scripts.

See Also

Bugs

Report any and all bugs to the clicraft issue tracker with as much detail as possible.

Authors

To see a full list of contributors, use git shortlog -s in the clicraft git repository.