This is an initscript to run a Minecraft or CraftBukkit server on CentOS, Fedora, and Ubuntu.
Note
As of 2015, this script is no longer actively maintained. All the supported distros are moving to systemd, making the concept of an LSB initscript rather outdated. All issues I see are related to bugs in Ubuntu's implementation of Upstart, it works perfectly on CentOS. However I think you are much better learning to use containers like Docker to control a single process and its files. There are many instructions around the internet on how to do this.
Thanks to all supporters over the years. You are welcome to fork this repo if you wish to continue development.
Features
Start, stop, restart CraftBukkit as a system service
Automatic (via cron) and manual logfile rotation
Automatic (via cron) and manual backups
Backup compression and rotation (keeps 7 days worth of backups)
Allows use of third-party backup solutions
Check latest Recommended Build and update to it if required
Information display including Java path, current memory usage, current TCP connections
Able to run multiple separate instances of the server at once
Supported Distributions
CentOS 6, CentOS 5, Fedora 14 (probably works on Fedora Core 6 and later, untested)
Ubuntu Server 12.04 LTS
Other distros which use SysV Init or Upstart will probably work.
Distros using systemd (Fedora 15+, Arch Linux, etc) may not work.
Requirements
screen, rsync
(you may need to install these)
bash, chkconfig or sysv-rc, coreutils, cronie, curl, diffutils, grep, initscripts, net-tools, procps, tar
(these should all be installed by default)
Oracle Java 7
Enough disk space to save your map twice, plus another ~5 times for a week of compressed backup space.
ie: If your map is 1Gb then you probably need at least 7Gb, plus any space your plugins require and any additional backups you'll be making.
The final compressed backup is done when the .md5 file appears in the backup directory.
Back up multiple maps
minecraft backup world1
minecraft backup world2
Check the server is running
minecraft status
Get some more info
minecraft info
* CraftBukkit (pid 9037) is running...
- Java Path : /usr/java/jre1.6.0_31/bin/java
- Start Command : java -Xms512M -Xmx3584M -jar craftbukkit.jar nogui
- Server Path : /home/bukkit/craftbukkit
- World Name : world
- Process ID : 9037
- Memory Usage : 742796 kb
- Active Connections :
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:25565 0.0.0.0:* LISTEN
tcp 0 0 192.168.2.99:25565 192.168.2.69:55507 ESTABLISHED
Broadcast a message to the server
minecraft say
Note that some punctuation like 'apostrophes' will not work.
License
GNU GPLv3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
请发表评论