Added: binupdate option to update only the server binary (for users who have no root access)

Changed: Standard updating process will now update your scripts as well

Changed: Clearlog now gives out a daily log file

Fix: Do command now works even if you don't tell the server what to do (Submitted by Ben Albon)

Fix: Feedback now works with a 1 second delay to give the server time to write the logfile (Submitted by Ben Albon)

Fix: The script should now always return the right state of the server (up/down)

Version 1.20

Added: Easy rollback function (see below)

Added: Full Bukkit support

Added: Stats for data processed during copy/saveback

Added: Download location

Changed: Splitted into two files (see below)

Changed: Settings section (for easy overview)

Changed: Commands are now independend of script version

Changed: Direct command pipein with "do" (see below)

Changed: Better timeout flexibility when shutting down etc.

Fix: Invocating now works from every user with su rights

Fix: "Give" works now smooth with damage ranges

Fix: rsync issue

Removed: Addons for Vanilla

Copyright: Everything now GNU GPL, nothing left of other authors

Known major issue (but not tested): On sytems with multiple non-sudoer users having access to the minecraft account it might be possible to gain root access by exploiting the maintenance file and restart the server with cron/startup. To prevent this issue, change its owner to root and chmod to 755.

Known issue: without RAMFS enabled mc_feedback might not be able to display results due to hdd delay. (THX @ Ben Albon for submitting!)

Known issue: 'do' does not work for commands longer than 6 words

Known (minor) issue: Startup/restart may result in 'could not be started' despite startup is successful

Those are asked by the autoconf.sh when choosing 'Standard update/install' or higher levels of detail.

MAINTAIN_SCRIPT_PATH

Here you have to provide the path to the maintenance script that will do all the work. You can store it where you like, preferably though is the home directory of the invocating user. Default is '/home/$MCUSERNAME'.

MAINTAIN_SCRIPT_NAME

The name of the maintenance script. Default name is 'server_control'.

CONFIG_PATH

This is where your config files (apart from the maintenance script) are stored. Don't store them inside the server path, for the owner is root! Default path is '$MAINTAIN_SCRIPT_PATH/scriptconf'.

CMDGRID_CONF

This file is user editable, although doesn't serve any function yet. Default name is 'commandgrid.conf'.

UPDATE_CONF

Determines which URLs are to use to download the scripts and server binaries - it will be overwritten if anything changes in here. Default name is 'updateurls.conf'.

AUTOCONF

This script writes/updates the init file. Although not needed after the installation/update, the file is stored to fast-detect changes. Default name is 'autoconf.sh'.

SERVERTYPE

Choose what you want to use - BUKKIT or VANILLA (the capitals are important!). It not only affects the update but also the processing of some commands. Default setting is 'VANILLA'.

SERVICE

The server binary. Default name is 'minecraft_server.jar'

SERVERPATH

Defines the path to your server and files. This DOESN'T include the script config files, which are stored separately (see above). Default path is '$MAINTAIN_SCRIPT_PATH/server'

Those are asked by the autoconf.sh when choosing 'Advanced update/install' or the highest level of detail.

CPU_COUNT

Defines how many cores of your machine minecraft/java is allowed to use at the same time. autoconf.sh will detect how many cores are installed on your machine and gives you the choice. Default setting is '1'.

MIN_SERVER_RAM

Defines with how much RAM the JAVA VM will start. For Bukkit this might even need to be 1500MB, depending on the plugins used. Default is '500M'.

MAX_SERVER_RAM

Defines how much RAM the JAVA VM is allowed to use. Shouldn't be all your RAM though; default is '2G'.

USE_RAMFS

This way your server will be transferred to your RAM at startup and run out of your RAM. Therefore you have the advantage of a super fast server without delays due to HDD reading, but the great disadvantage of less RAM available for running processes and CERTAIN data loss when your server suffers a power loss or is shut down a wrong way.

It is strongly recommended to use Cron for very frequent savebacks to your server directory on your HDD!

Choose the frequency on the decision how much you want to redo in a worst case scenario, since rsync needs just one or two seconds to write back the data, but the more often you save, the more often your HDD has to be waked. 10 Minutes is good, but if your server is running 24/7 for years without problems, you can do it with the backup routine (which does a saveback prior to the backup).

Invocation for Cron: "/etc/init.d/minecraft cronsave"

Note that depending on your world size this might cause you to lose 2 GB and more RAM.

To activate the option set the variable to 'yes'. Default setting is 'no'.

USE_RAMDIR

Since some people use the RAM for working on documents (and other stuff) it is a good idea to create a unique directory in your RAM to separate the server from everything else. Choose a name you like or leave it be. Default directory name is 'minecraft'.

Only shown and asked if you wanted an 'Expert install/update', which is discouraged for 99%.

JVM_OPTIONS

You might render the JAVA VM options here. Default is only 'nogui'.

INVOCATION

For the JAVA nerds. If you have no clue what this means, leave it alone! Default is 'java -Xmx$MAX_SERVER_RAM -Xms$MIN_SERVER_RAM -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts -jar $SERVICE $JVM_OPTIONS'

You only need to alter them if you want to tweak your JVM. Most users should keep out here.

This is only for people who have USE_RAMFS set to 'yes'. It writes the whole RAM directory back to the server directory.

backup

This will backup the whole directory provided by "SERVERPATH" to a directory named after the date and time of creation inside the provided "BACKUPPATH", including every settings file and the server jar, so you can rollback with a single invocation if things go rimwards. If you backup more than once a minute, the script will just update the existing folder.

Will browse through your backup directory and will use the latest (in case of not providing any number or providing 1) backup in there. By providing the number 2, you take the one before the latest backup and so on. Unreasonably high numbers will not cause the script to interfere or cry out, it will then just take the first backup ever made (since there's nothing before it).

rollback sel

Will show you the list of all available backups - you just type the one of your desire in.

rollback undo

You made a misstake and rolled some ancient stuff over your fancy new server? No problem - the script keeps a backup of the state of your server before you've done the rollback. But be careful: It only keeps one! One step back is no problem, two won't be possible (if you did not backup manually before).

rollback help

displays all the options and a brief description

Rollback is designed to be clever - and to prevent you doing anything wrong. Of course you are the admin, and thus able to hurt yourself, but the script will ask you at least before executing the rollback if you really want to do that.

For Cron there are separate invocations, since visual feedback is usually not very interesting for it. So these are mostly like the standard invocation, only with less (to no) feedback.

cronsave

See 'save' above.

cronbackup

See 'backup' above.

cronlog

It rearranges your logfile and splits it into different files:

server.log.<date>

This is the old server.log, without every line containing the following phrases:

94.231.101.83

This is a server which checks for the minecraft server to be online. If you haven't announced your server in public, you won't recognize anything, if you have, you'll save yourself about 150 entries a day.

Disabling level saving..

If you have Cron running cronsave or cronbackup, you'd see that every time it runs in your original server.log

CONSOLE: Forcing save..

Same as above

CONSOLE: Save complete.

Same as above

CONSOLE: Enabling level saving..

Same as - Yeah, I know, it's a curse, that's why I remove them from the file.

You may add a line of your own, just go to the mc_clearlog section in the script, copy one of the middle lines to the following and modify that.

forbidden.log

If your server is white-listed, every connection attempt that is rejected by the server is logged here.

warnings.log

Contains every warning the server is printing to the server.log, and only those, except the warning about the server not being able to keep up. Useful for finding griefers who attempt to fly and so on...

If you like to use console commands, you just need to invocate the script with

/etc/init.d/minecraft do <desired console command>

There are only two major tweaks to them:

GIVE/XP

You're now able to give your players almost any amount of things - the script will calculate how often it has to pipe the command to the server utilizing the maximum amount (64 for give on vanilla, 5000 for xp on both) per invocation. So giving 1000 stone or 1,000,000 experience to anybody with a single command won't be a problem any longer. NOTICE: Being very generous might crash your server and making whole chunks inaccessible. Be careful!

GIVE - Damage value

Since I'd like to give people sometimes a whole set of things (like maps or dyes) with a single command, I included a "damage value range". So if you provide a second damage value like

/etc/init.d/minecraft command give Player 358 1 0 24

the script will give "Player" 25 maps, beginning with map_0 until map_24 (inclusive), one each. Combined with the ability to skip the amount limit, the script will now gently paste as much items of a single damage value as you've given the user, then repeating that with every other damage value in the row. Be careful, this leads to excessive amounts of entities on the server if used generously!

If you encounter some bugs or have some ideas to implement in here please let me know either on the bug & suggestions page or via Twitter. You may also follow me on Twitter to ask your questions, post me your ideas and get news first when a new version is about to hit the floor.

Tools

Content is available under CC BY-NC-SA 3.0 unless otherwise noted.Minecraft content and materials are trademarks and copyrights of Mojang and its licensors. All rights reserved.
This site is a part of Curse, Inc. and is not affiliated with Mojang.