-
Notifications
You must be signed in to change notification settings - Fork 4
Notes
This scrript starts up the Minecraft server (or bukkit, or whatever you use) on system boot as a service.
This script MUST be run as root or as a user with mount priveleges if the $RAMDISK
variable is set to "true".
start | Starts the service |
stop | Stops the service (initiates save-all and then stop) |
restart | Restarts the service (stop followed by start, or just start if service is not running) |
status | Displays the status of the service (Whether or not it's running) |
worldbackup | Backs up your worlds to $ROOT_BUPATH/$WORLD_BUDIR |
rdbackup | Backs up the entire ramdisk to $ROOT_BUPATH/$RD_BUDIR |
### Settings:
There are many variables in this script which you may modify to suite your operating environment.
-
USERNAME
-
This variable should be set to the user which the Minecraft server will run under.
-
GROUPNAME
-
This variable should be set to the group which will have access to all files related to your Minecraft server.
-
SCREEN_NAME
-
The script starts the service in a screen session for easy remote accessibility.
-
This variable sets the name of the session.
-
BUILD
-
This should be set to the build number or version of the server you're running (like b1337 for bukkit, or v1.8.1 for vanilla).
-
This is only used when looking for the directory your server runs under (for example, our server has directories named "b1240" and "b1337", and since we run off of b1337 as it's the most recent, we set this variable to b1337).
-
SERVICE
-
This should be set to the name of the .jar file which starts your server (craftbukkit.jar for bukkit, minecraft.jar for vanilla).
-
This must be set to the name of the .jar file used in the invocation since the service will show up in top or gnome-system-monitor with the name of the .jar file used in the invocation.
-
INVOCATION
-
This should be set to the command-line statements used to start your server.
-
For example:
java -Xmn256M -Xms512M -Xmx1024M -jar craftbukkit.jar
-
RAMDISK
-
This should be set to "true" if you want your worlds to be loaded into a ramdisk.
-
It's highly recommended that you set up automatic backups while using this feature.
-
For our server, we simply set up a cron job that runs
/etc/init.d/minecraft worldbackup
every hour.
Note: This script will implement automatic backups in the future as a toggleable feature (similar to the ramdisk feature).
### File Paths:
-
ROOT_PATH
-
This should be set to the directory location where all files pertaining to your Minecraft server will be stored.
-
Since this is a path variable and not a directory variable, this can point to wherever you like.
-
For example:
/mnt/codecraft
-
WORLD_DIR
-
This is the name of the folder where your worlds will be located.
-
This script expects the
$WORLD_DIR
folder to be located at$ROOT_PATH/$WORLD_DIR
-
For example, if
WORLD_DIR="worlds" then it might be located here:
/mnt/codecraft/worlds` -
SERVER_DIR
-
This is the name of the folder where your server files will be located.
-
This script expects the
$SERVER_DIR
folder to be located at$ROOT_PATH/$SERVER_DIR
-
For example, if
SERVER_DIR="servers" then it might be located here:
/mnt/codecraft/servers` -
RD_DIR
-
This is the name of the folder where your ramdisk will be located.
-
This script expects the
$RD_DIR
folder to be located at$ROOT_PATH/$RD_DIR
-
For example, if
RD_DIR="ramdisk" then it might be located here:
/mnt/codecraft/ramdisk` -
ROOT_BUPATH
-
This is the directory location where all your backups will be stored.
-
Since this is a path variable and not a directory variable, this can point to wherever you like.
-
For example:
/mnt/codecraft/archives
or$ROOT_PATH/archives
or even/opt/codecraft/archives
### Messages:
These variables represent messages which are sent to the bukkit/vanilla console with the "say" command. They should be fairly self explanitory. For example, when you use the "worldbackup" command, SAVE_OFF_MSG will be displayed to users in-game, followed by BACKUP_START_MSG and, if the backup is successful, followed by BACKUP_DONE_MSG. It should end with SAVE_ON_MSG.
SAVE_OFF_MSG | Disabling saving. Server going readonly... |
SAVE_ON_MSG | Enabling saving. Server going read-write... |
BACKUP_START_MSG | SERVER BACKUP STARTING |
BACKUP_RD_START_MSG | RAMDISK BACKUP STARTING |
BACKUP_DONE_MSG | SERVER BACKUP COMPLETE |
BACKUP_FAIL_MSG | SERVER BACKUP FAILED |
STOP_MSG | SERVER SHUTTING DOWN IN 15 SECONDS |
RESTART_MSG | SERVER GOING FOR RESTART |