Giter Site home page Giter Site logo

alvesvaren / mccli Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 1.0 201 KB

Command-line interface to manage multiple (or one) Minecraft server on a Linux system.

License: GNU General Public License v3.0

Python 89.97% Shell 10.03%
minecraft minecraft-server-software minecraft-server minecraft-server-wrapper spigot papermc paper vanilla-minecraft automation cli

mccli's Introduction

mccli

This is a small program and library that makes it much easier to manage minecraft servers on GNU/Linux (and probably other) OSes. It provides some easy to use commands that allows you to for example, upgrade the server binary, create a new server or change the server port etc. just with one command. It also makes it easy to attach to the server console from the command line.

Install

Before installing, make sure the dependencies are installed.

# Ubuntu/Debian:
sudo apt install python3-libtmux python3-dbus python3-requests dbus-user-session tmux python3-pip
# You would probably want a java runtime too: 
sudo apt install openjdk-11-jre-headless

# Arch:
sudo pacman -S python-libtmux python-dbus python-requests
# JRE: jre-openjdk-headless

Then just follow these steps for a standard installation:

sudo useradd minecraft
sudo mkdir /home/minecraft && sudo chown minecraft:minecraft /home/minecraft
sudo mkdir /opt/mccli && sudo chown minecraft:minecraft /opt/mccli
sudo -u minecraft git clone https://github.com/alvesvaren/mccli.git /opt/mccli
cd /opt/mccli
sudo ./install.sh

Update

cd /opt/mccli
sudo ./update.sh

Note: If upgrading from 0.0.14 or earlier, run sudo systemctl disable /etc/systemd/system/[email protected] and sudo rm /usr/bin/mccli before upgrading

Another note: If upgrading from between 0.1.6 and 0.1.9, you might need to run sudo -u minecraft git reset --hard origin/master and then re-run the script ./update.sh

Usage

Basic usage

mccli create servername
mccli enable --now servername
mccli console servername

All available commands

Command + arguments Description Example
mccli create [name] [--provider {vanilla,papermc,spigot}] Creates a new server mccli create example --provider vanilla
mccli update <name> [--provider {vanilla,papermc,spigot}] Change the server jar version mccli update example --provider papermc
mccli status <name> Shows the current (systemd) status for the specified server mccli status example
mccli start <name> Starts the specified server using systemd mccli start example
mccli stop <name> Stops the specified server using systemd mccli stop example
mccli enable [--now] <name> Enable automatic starting of the server (on reboot). If called with --now, also start it mccli enable --now example
mccli disable [--now] <name> Disable automatic starting of the server. If called with --now, also stop it mccli disable --now example
mccli restart <name> Restart the server mccli restart example
mccli attach <name> Attach to the server console. To detach, Press Ctrl+b followed by d mccli attach example
mccli run <name> <command> Send the specified command to the server (using tmux send-keys) mccli run example say Hello everyone!
mccli runner [--tmux] <name> Run the specified server in this tty. If called with --tmux, starts in a tmux session mccli runner example
mccli list List all running servers (that has an active tmux session) and their version mccli list
mccli modify [--file] <name> <key> <value> Modify the server.properties file (if no other was specified). mccli modify example server-port 25566
mccli Shows the version and usage of mccli mccli

Note: You can run any command with the argument -h to show the usage for that specific command

Help! My server doesn't start!

You are probably using the wrong java version or you are missing some dependency. Try running the server using mccli runner <name> and see why it errors out.

Develop

This is sort of broken right now but it should work after you've installed mccli at least once using the "Install" instructions

  1. Clone the repository wherever you'd like
  2. cd mccli
  3. git checkout dev
    python -m venv env
    source env/bin/activate
    pip install -r requirements.txt
  4. Make sure the mccli binary is correct (whereis mccli should return something that's in this repository)

Project status

Planned features:

  • Code to interface with server files
    • Vanilla support
    • Paper support
    • Waterfall support
  • Code to manage virtual console sessions (for example tmux)
  • Systemd service (template) to start minecraft servers
  • Code to manage systemd service
  • Backup system (both automatic and manual)
  • LXC (or possibly systemd-nspawn) support for running the servers in separate file systems (safer and easier to backup)
  • Colors when running some commands

Other features that I might add in the future

  • Web interface
  • Spigot/Buildtools support
  • Bungeecord support
  • SSH server that just handles mccli
    • Client that can communicate using said ssh server
  • REST api for use with some sort of client
  • Command scheduling (you could probably do this with crontab already)
  • FTP server
  • Access policies to manage user access to different servers
  • Automatic port forwarding using UPnP
  • YML file support when using modify command
  • Plugin manager
  • CLI autocompletion

mccli's People

Contributors

almqv avatar alvesvaren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

almqv

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.