Skip to content

Minecraft Server manager

License

Notifications You must be signed in to change notification settings

Kraftland/mcctl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mcctl

State-of-the-art Shitcode


Get it from AUR

mcctl (aka minecraft-server-control) is a bash script which can automatically run and update your minecraft server.

Warn: Windows and macOS are not supported, use Arch Linux to achieve best experience.

Usage

First set 2 environment variables: $version and $serverPath. This will tell mcctl your desired version and path to your server

[Environment Variables] mcctl --[Options]

Examples:

version=1.19 serverPath=/mnt/main/Cache/Paper bash mcctl --update --autodetect

Install mcctl as a system command (Not required)

Note: If you haven't installed mcctl to your system, just cd to mcctl and replace mcctl with ./mcctl

Arch Linux

Install the mcctl-git from aur

Examples using yay:

yay -S mcctl-git

Other Linux

git clone https://github.com/Kimiblock/mcctl.git && cd mcctl && ./mcctl --install

Uninstall mcctl command

mcctl --uninstall

Update your Minecraft server and plugins

Automatically

Tip: Now you can let mcctl automatically detect servers and plugins to install, just type:

mcctl --update --autodetect

Manually

mcctl --update --[options]
Options Effects
mojang Update Mojang server.
spigot Update spigot.
paper Update paper.
sac Update SoaromaSAC
floodgate Update floodgate.
geyser Update geyser.
--systemupdate Fully update your system. ( Run with sudo when -unattended activated! )
--unsafe Disable default protecting.
--newserver Automatically create server folder.
--clean Clean leftovers.
mtvehicles Update mtvehicles (Unnecessary because you can update plugin by /mtv update)
multilogin Update MultiLogin

Snapshots (Expermental)

Create a snapshot

mcctl --create-snapshot

You can also specify where to store your snapshots by $snapshotPath

Remove old snapshots

Remove snapshots older than $2 day(s)

mcctl --delete-snapshot $2

Restore a snapshot

Warning! Turn off your Minecraft server or you might break your system.

Restore snapshot $2 day(s) ago:

mcctl --restore-snapshot $2

Load server at startup

[Environment Variables] mcctl --start [Server name] --d
Server name Effects
paper Start PaperMC
spigot Start SpigotMC
mojang Start Mojang server

Note: Install screen if you add -d, you can go back to your server session by screen -r mc.

Save your options and environments

[Environment Variables] mcctl --save-conf --[Options]

Next time you use mcctl, just type mcctl. Script will automatically remember what you entered last time.

Automatically send report mails

Tip: Install and setup ssmtp first.

mcctl --mail-report $2 #replace $2 with your mail address 

Install requirements (Currently beta, only pacman and apt recive full support)

Options Effects
--instreq Install requirements

Tips and tricks

Control what will mcctl output. Enter options to control

Options Effects
--verbose Output anything
--quiet Hide outputs

Delete BuildTools' cache and script's logs

mcctl --clean

Avoid confirming anything

mcctl --unattended

Avoid entering environment variables

Method 1

Edit /etc/environment, add those lines:

version=Target Minecraft version
serverPath=Path to server directory

Then reboot or re-login

Method 2

cd to your server

mcctl --currentdirectory --latest [options]

This will set server path to your current folder and default to the latest version.

Update mcctl command?

Just type mcctl install again, script will download the latest version of itself and perform updates.

Update server everyday?

Get the cronie package and enable cronie.service.

Type crontab -e and enter those line:

0 0 * * * mcctl --[Options]

Check if you have environment variables set, either in /etc/environment or before mcctl

Warning: you have to manually restart the server, otherwise some plugins WON'T use new features./reload or /reload confirm

How to create a entirely new server?

Just add a --newserver option, script will automatically handle it.

To-dos

  1. Save configurations to ~/.config.

Known bugs

  • Spigot's own build tools may occationally crash, mcctl --clean might fix it.

  • Do not use zsh or any other shell, change your default shell to bash chsh -s /bin/bash or run mcctl under bash (If your default shell isn't bash, some non-critical problem will occur)

  • Can't download sac due to spigotmc.org's unique protection

Troubleshoot

Exit code

Can not create directory

Make sure you have control of the directory

Non-64-bit system detected

[Environment Variables] mcctl --unsafe --[Options]

Environment variables not set

Set 2 environment variables serverPath version, either before mcctl command or in /etc/environment.

System update failed

Check if you have full control of your server.

BuildTools failed to start

mcctl --currentdirectory --latest

No jar file detected

Check if you have specified correct directory.

Screen not installed

Install package screen or

mcctl --instreq  #Currently unstable

Package manager not supported

mcctl cannot detect which package manager you're using, remove --systemupdate and wait for support.

Systemd missing

install package systemd, its not supported by --instreq by default because mess up your init will cause unexpected issues.

Network unrechable

Can't reach github.com, check your network and proxy settings.

Permission denied

Run the script as root or remove --unattended

mcctl lock file found, make sure you doesn't run another mcctl process

mcctl generates a lock file ~/.mcctl.lock to prevent multiple mcctl run at the same time.

Several mcctl process may cause problems which might break your server. If you sure that no mcctl running (Check with htop btw), just remove ~/.mcctl.lock

Exit code from minecraft detected

Your server throws a exit code, check your screen name by screen -ls then screen -r $screenName

Internal error

This is an undefined exit code, you can check ~/mcctl_debug.log