Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 97 lines (85 sloc) 2.35 KB
#!/usr/bin/env bash
# Minecraft CraftBukkit script tool
# Created by Marc 'rhaamo' Lagrange <rhaamo@gruik.at>
# Under http://sam.zoy.org/wtfpl/
### EDIT HERE ###
# Lang for errors, currently supported: fr, en
MCS_OUTPUT_LANG=fr
MC_PATH=/usr/minecraft/home
MC_SCRIPT_PATH_LIB=${MC_PATH}/bin/minecraft_tool
MC_JAR_NAME="craftbukkit-0.0.1-SNAPSHOT.jar"
SCREEN_NAME="minecraft"
MEMALOC=2048
DISPLAY_ON_LAUNCH=0
WORLD_NAME="world"
BKUP_PATH=/usr/minecraft/www/nux/backup
BKUP_FULL_LINK=${BKUP_PATH}/${WORLD_NAME}_full.tgz
BKUP_URL="http://nux.no-ip.org/nux/backup/" # With trailing "/" !
LOGS_DIR=${MC_PATH}/logs
LOGS_DAYS=7
LOGS_OTHER_FILENAMES="worldedit.log" # Other logs in $MC_PATH
### END OF EDIT ###
### DONT TOUCH HERE NOW ###
MTOOL_BIN_NAME_BASENAME=`basename $0`
MTOOL_BIN_NAME_FULLPATH=$0
. ${MC_SCRIPT_PATH_LIB}/lang.${MCS_OUTPUT_LANG}.sh
. ${MC_SCRIPT_PATH_LIB}/check_config.sh
check_configuration
. ${MC_SCRIPT_PATH_LIB}/utils.sh
. ${MC_SCRIPT_PATH_LIB}/start_stop.sh
. ${MC_SCRIPT_PATH_LIB}/logs.sh
. ${MC_SCRIPT_PATH_LIB}/backups.sh
usage() {
echo "Usage: $0 opts"
echo " Options:"
echo " status ${MCS_LANG_MSCRIPT_OPT_STATUS}"
echo " start [force] ${MCS_LANG_MSCRIPT_OPT_START}"
echo " stop ${MCS_LANG_MSCRIPT_OPT_STOP}"
echo " restart [warn] ${MCS_LANG_MSCRIPT_OPT_RESTART}"
echo " rotatelogs ${MCS_LANG_MSCRIPT_OPT_ROTATELOGS}"
echo " cleanlogs ${MCS_LANG_MSCRIPT_OPT_CLEANLOGS} server.log ${LOGS_OTHER_FILENAMES}"
echo " backup ${MCS_LANG_MSCRIPT_OPT_BACKUP}"
echo " screen ${MCS_LANG_MSCRIPT_OPT_SCREEN}"
exit 1
}
if ! [ $# -gt 0 ]; then
if [ $ONLINE -eq 1 ]; then
if [ ${DISPLAY_ON_LAUNCH} -eq 1 ]; then
display # the minecraft screen
else
usage # display usage
fi
else
echo ${MCS_LANG_LIB_UTILS_SERVER_SEEMS_OFFLINE}
fi
fi
case $1 in
status)
display_minecraft_status # Show minecraft status
;;
start)
opts_minecraft_start # Start minecraft server
;;
stop)
server_stop $2 # Stop minecraft server
;;
restart)
opts_minecraft_restart $2 $3 # Restart minecraft server
;;
rotatelogs)
opts_minecraft_rotatelogs # Rotate logs
;;
cleanlogs)
opts_minecraft_cleanlogs # Clean current log
;;
backup)
opts_minecraft_backup # Create world backup
;;
screen)
opts_minecraft_screen # Attach minecraft screen
;;
*)
usage
;;
esac
exit 0
Jump to Line
Something went wrong with that request. Please try again.