Skip to content

Instantly share code, notes, and snippets.

@admalledd
Created April 27, 2012 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save admalledd/2514248 to your computer and use it in GitHub Desktop.
Save admalledd/2514248 to your computer and use it in GitHub Desktop.
minecraft config files
# A simple backup implementation
do save-all
do save-off
#note: ##($RECONFIG) edit this to point to the correct master_backup.sh for this server path if multiple share the same host.
execWait /home/admalledd/minecraft/cur/sh/master_backup.sh
do save-on
do save-all
#!/bin/sh
#echo the current server base directory
echo $(dirname $(readlink -f $(dirname $0)/../start.sh))
#!/bin/bash
echo ---------------->>/tmp/rdiff-log
echo $(date) >>/tmp/rdiff-log
##backup entire server:
#current server path:
CUR=$($(dirname $0)/curserverpath.sh)
rdiff-backup -v6 $CUR /home/$USER/minecraft/backup/ >> /tmp/rdiff-log
# A simple restart implementation
do say good bye! server restarting be back in a tick (5-10 minutes)
do save-all
#exec /mnt/minecraft/cur/sh/restart.sh
exec /home/admalledd/minecraft/cur/sh/restart.sh
#!/bin/bash
main_server_screen="server"
function runcmd {
if [ -n "$STY" ]; then
screen -x $1 -p $2 -X stuff "$3$(echo -ne '\r')"
else
screen -p $2 -X stuff "$3$(echo -ne '\r')"
fi
}
#runcmd $main_server_screen 0 "echo test"
CUR=$($(dirname $0)/curserverpath.sh)
runcmd $main_server_screen 0 "stop"
sleep 60
#start normal server again
runcmd $main_server_screen 0 "./start.sh copy_map"
# +----------------> Minute
# | +--------------> Hour
# | | +------------> Day of month
# | | | +----------> Month
# | | | | +--------> Day of week
# | | | | | +--> Script/File
# | | | | | |
# * * * * * uname.scc
#say basic server admin-y stuff
*/30 * * * * sayadmin-y.scc
#backup every 60 minutes, 45 minutes after the hour to stay clear of the reboot times
45 * * * * backup.scc
#warn of restart 15 minutes before it occurs:
45 4 * * * warnbackup15.scc
50 4 * * * warnbackup10.scc
55 4 * * * warnbackup5.scc
59 4 * * * warnbackup1.scc
#do restart:
0 5 * * * restart.scc
#!/bin/sh
out="$($(dirname $0)/curserverpath.sh)/craftbukkit.jar"
if [ -n "$1" ]; then
if [ "$1" = "dev" ]; then
wget "http://dl.bukkit.org/downloads/craftbukkit/get/latest-dev/craftbukkit-dev.jar" -O $out
echo 'using latest dev build'
elif [ "$1" = "beta" ]; then
wget "http://dl.bukkit.org/downloads/craftbukkit/get/latest-beta/craftbukkit-beta.jar" -O $out
echo 'using latest beta build'
elif [ "$1" = "rb" ]; then
wget "http://dl.bukkit.org/downloads/craftbukkit/get/latest-rb/craftbukkit-rb.jar" -O $out
echo 'using latest recomended build'
else
echo 'no build chosen, use ./CMD (dev|beta|rb)'
fi
fi
do say server restart in 15 minutes! dont say you were not warned!
###EDITNOTE: this file is the same for 10,5, and 1 minute warning except the message, just an example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment