Owner’s Corner: Start Script
So, a minecraft server is a java .jar program, which is a cross-platform executable. If you wanna be really pure about it, the way to start a minecraft server is the following command:
java -server -Xmx3400M -jar craftbukkit-1.3.2-R1.0.jar noguiWhat that is doing is saying "Run a java program, allocate it 3.4GB of RAM, it's a .jar file which is a library of multiple .java files, here is the archive's name, and run it without the user interface.
Nevertheless, this won't actually work. On a linux machine, when you initiate a process like this server, you have to keep the window open to keep the process alive. So, if I'm on my work computer, and the server goes down, and I log in and restart it, then go to close my work computer down...the server dies until I restart it. What NEEDS to happen is to initiate a program and then disconnect from it, and that is done primarily with the linux command "screen." You should read the whole description for that here. What your'e doing is creating like a virtual screen which is running the server process, then we can connect and disconnect from that screen from other places. It allows the server to run on its own.
So, we could initiate the server now with the following command:
screen -dmS Bukkit java -server -Xmx3400M -jar craftbukkit-1.3.2-R1.0.jar noguiThis command uses 3 flags, -dmS, which basically say "kill any existing screens using the name Bukkit, then make a new one with the name Bukkit, and in that screen run the start server command." From in here, you can run the command "screen -x Bukkit" and re-attach to that screen, or from inside the screen "ctrl+a ctrl+d" to go back out to the main command line. Also, from the command line, we can type "screen -dr Bukkit -p 0 -X stuff "$(printf "say I Am Poop\r")"" to send the command "say I Am Poop" which prints "I Am Poop" in game, and that can be used to send any command in-game without being logged into the console.
Still, there's issues with that. Let's say IMGArY started the server, and I didn't know it, so I accidentally kill his version and log everyone out, then start it over. It's messy...what you'd have to do is pull a list of existing screens with "screen -ls" and if it's active, connect to it, and if not, start it. That's not very tidy. What's better is a script, that runs the check for existing screens, and if it finds one, connects to it, and if not, starts it. But what if the name of the server executable changes, like with a new version of bukkit? Ask a whole series of what-ifs and you come up with a pretty decent server-running script that does everything you want. We didn't write this, and cnc made some mods to it, but for the most part it's how it was when we found it:
# version 5.0.3 (04.01.2012)
# Author: Tealk @ anzahcraft.de
# http://dev.bukkit.org/server-mods/linux-server-startscript-menu/
# Configuration
SERVER="1"
CRAFTBUKKITUPTODATEB="2"
CRAFTBUKKITUPTODATEP="2"
BKUP="/var/bukkit/backup"
BKUPOLD="1"
BKUPOLDT="2"
CRONBKUPOLD="1"
DIR1="/var/bukkit"
NAME1="Bukkit"
DESC1="teh3l3m3nts Minecraft Server"
BKUPWORLD1="1"
WORLDNAME1="world"
BKUPNETHER1="1"
DIR2="/home/minecraft/rp"
NAME2="mcserverrp"
DESC2="Minecraft RP Server"
BKUPWORLD2="1"
WORLDNAME2="world"
BKUPNETHER1="1"
DAEMON="java"
PARAMS="-server -Xmx3400M -jar"
SERVERMOD="1"
MODJAR="craftbukkit-1.3.2-R1.0.jar"
PARAMS2="nogui"
DLBUKKIT="http://ci.bukkit.org/job/dev-CraftBukkit/lastStableBuild/artifact/target/craftbukkit-0.0.1-SNAPSHOT.jar"
# DO not EDIT
DATE=$(date +%d.%m.%y-%H.%M)
# End of configuration
STARTS1() {
DIR="$DIR1"
NAME="$NAME1"
DESC="$DESC1"
SERVERSTART
}
STARTS2() {
DIR="$DIR2"
NAME="$NAME2"
DESC="$DESC2"
SERVERSTART
}
STOPS1() {
DIR="$DIR1"
NAME="$NAME1"
DESC="$DESC1"
SERVERSTOP
}
STOPS2() {
DIR="$DIR2"
NAME="$NAME2"
DESC="$DESC2"
SERVERSTOP
}
RESTARTS1() {
STOPS1 && STARTS1 || exit 1
}
RESTARTS2() {
STOPS2 && STARTS2 || exit 1
}
SAYS1() {
if [[
screen -ls |grep "$NAME1" ]]; thenscreen -S "$NAME1" -p 0 -X stuff "$(printf "say $say1\r")"
sleep 1
else
echo "$DESC1 seems to be offline"
fi
}
SAYS2() {
if [[
screen -ls |grep "$NAME"2 ]]; thenscreen -S "$NAME2" -p 0 -X stuff "$(printf "say $say2\r")"
sleep 1
else
echo "$DESC2 seems to be offline"
fi
}
SCREENS1() {
if [[
screen -ls |grep "$NAME1" ]]; thenscreen -r "$NAME1"
else
echo "$DESC1 seems to be offline"
fi
}
SCREENS2() {
if [[
screen -ls |grep "$NAME"2 ]]; thenscreen -r "$NAME2"
else
echo "$DESC2 seems to be offline"
fi
}
RRB() {
if [ "$SERVER" = "2" ]; then
STOPS1 && STARTS1 && STOPS2 && STARTS2 || exit 1
else
STOPS1 && STARTS1 || exit 1
fi
}
STATUS() {
if [ "$SERVER" = "2" ]; then
if [[
screen -ls |grep "$NAME1" ]]; thenecho "$DESC1 is online"
else
echo "$DESC1 seems to be offline"
fi
if [[
screen -ls |grep "$NAME"2 ]]; thenecho "$DESC2 is online"
else
echo "$DESC2 seems to be offline"
fi
else
if [[
screen -ls |grep "$NAME1" ]]; thenecho "$DESC1 is online"
else
echo "$DESC1 seems to be offline"
fi
fi
}
UPDATE() {
if [ ! -d "$BKUP" ]; then
mkdir "$BKUP"
fi
if [ "$SERVER" = "2" ]; then
MULTISERVER_UP
else
SINGLESERVER_UP
fi
if [ "$RESTARTSERVER" = "yes" ]; then
echo "Server up tp date please restart server now!!"
else
echo "Server have no Updates, no restart necessary"
fi
exit 1
}
SERVERSTART() {
if [[
screen -ls |grep "$NAME" ]]; thenecho "found running process: $DESC"
echo "Dont start the Server twice"
exit 1
else
if [ "$UID" = "0" ]; then
echo WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT
for c in $(seq 1 5); do
echo -n "!"
sleep 1
done
echo !
fi
echo "starting the $DESC"
if [ -e "$DIR" ];then
if [ -x "$DIR" ]; then
cd "$DIR"
if [ ! -x $DATA ]; then
echo "$DATA is not executable, trying to set it"
chmod u+x $DATA
else
if [ "$SERVERMOD" = "1" ]; then
echo "Starting... \" $NAME $DAEMON $PARAMS $MODJAR \""
echo "This may take a minute..."
screen -dmS $NAME $DAEMON $PARAMS $MODJAR
else
screen -dmS $NAME $DAEMON $PARAMS minecraft_server.jar $PARAMS2
fi
fi
else
echo "No such directory: $DIR!"
fi
fi
fi
}
SERVERSTOP() {
if [[
screen -ls |grep "$NAME" ]]; thenecho -n "Stopping $DESC"
echo
screen -dr "$NAME" -p 0 -X stuff "$(printf "save-all\r")"
echo "30 Second Warning."
screen -dr "$NAME" -p 0 -X stuff "$(printf "say Server will restart in 30s !\r")"
sleep 20
echo "10 Second Warning."
screen -dr "$NAME" -p 0 -X stuff "$(printf "say Server will restart in 10s ! Please dissconnect \r")"
sleep 10
screen -dr "$NAME" -p 0 -X stuff "$(printf "stop\r")"
echo "Sopping Server wait 60 Seconds"
sleep 60
screen -r "$NAME" -p 0 -X quit
echo " done."
cat "$DIR"/server.log >> "$DIR"/full_server.log
rm -rf "$DIR"/server.log
else
echo "Coulnd't find a running $DESC"
fi
}
SINGLESERVER_UP() {
echo "Backing up current binaries..."
cd "$DIR1"
tar -czf "$NAME1"-"$DATE".tar.gz plugins/ craftbukkit.jar server.log
mv "$NAME1"-"$DATE".tar.gz "$BKUP"
if [ "$BKUPWORLD1" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME1" ]; then
mkdir "$BKUP"/"$WORLDNAME1"
fi
tar -czf "$NAME1"-"$DATE".tar.gz "$WORLDNAME1"/
mv "$NAME1"-"$DATE".tar.gz "$BKUP"
fi
if [ "$BKUPNETHER1" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME1" ]; then
mkdir "$BKUP"/"$WORLDNAME1"
fi
tar -czf "$NAME1"_nether-"$DATE".tar.gz "$WORLDNAME1"_nether/
mv "$NAME1"_nether-"$DATE".tar.gz "$BKUP"/"$WORLDNAME1"/
fi
if [ "$CRAFTBUKKITUPTODATEB" = "1" ]; then
echo "Downloading Bukkit..."
screen -dr "$NAME1" -p 0 -X stuff "uptodate update"
screen -dr "$NAME1" -p 0 -X stuff $'\n'
until [ -e "$DIR1/bukkit_update/download.ready" ]; do
for c in $(seq 1 5); do
echo -n "."
sleep 5
done
if [ -e "$DIR1/bukkit_update/download.fail" ]; then
break
BUKKITUP="fail"
fi
done
echo !
if [ -e "$DIR1/bukkit_update/download.ready" ]; then
BUKKITUP="ok"
fi
fi
if [ "$CRAFTBUKKITUPTODATEP" = "1" ]; then
echo "Downloading Plugin Updates..."
screen -dr "$NAME1" -p 0 -X stuff "uptodate plugin"
screen -dr "$NAME1" -p 0 -X stuff $'\n'
until [ "$PLDMC1" = "ok" ] && [ "$PLDMC2" = "ok" ]; do
if [ -e "$DIR1/bukkit_update/plugins/plugin.ready" ]; then
PLDMC1="ok"
elif [ -e "$DIR1/bukkit_update/plugins/plugin.fail" ]; then
PLDMC1="fail"
fi
for c in $(seq 1 5); do
echo -n "."
sleep 5
done
if [ "$PLDMC1" = "fail" ]; then
break
fi
done
if [ "$PLDMC1" = "ok" ]; then
echo "Copy updates in the plugin Folder? (yes/no)"
read pcopy
if [ "$pcopy" = "yes" ] ; then
if [ "$BUKKITUP" = "ok" ] ; then
echo "Update Bukkit..."
cp "$DIR1"/bukkit_update/craftbukkit.jar "$DIR1"
chmod 777 "$DIR1"/craftbukkit.jar
else
echo "No Bukkit Update"
fi
echo "Update $DESC1 Plugins..."
cp -r "$DIR1"/bukkit_update/plugins/.jar "$DIR1"/plugins/
echo "done"
PLCP1="ok"
RESTARTSERVER="yes"
else
echo "Updates are in the $DIR1/bukkit_update/plugins Folder"
fi
else
RESTARTSERVER="no"
fi
fi
if [ "$CRAFTBUKKITUPTODATEB" = "1" ] && [ "$CRAFTBUKKITUPTODATEP" = "1" ]; then
echo "Cleaning temporary Plugins"
rm -f "$DIR1"/bukkit_update/craftbukkit.jar "$DIR1"/bukkit_update/download.fail "$DIR1"/bukkit_update/download.ready
rm -rf "$DIR1"/bukkit_update/plugins/.jar "$DIR1"/bukkit_update/plugins/.zip "$DIR1"/bukkit_update/plugins/.html "$DIR1"/bukkit_update/plugins/plugin.ready "$DIR1"/bukkit_update/plugins/plugin.fail
elif [ "$CRAFTBUKKITUPTODATEB" = "1" ]; then
echo "Cleaning temporary Plugins"
rm -f "$DIR1"/bukkit_update/craftbukkit.jar "$DIR1"/bukkit_update/download.fail "$DIR1"/bukkit_update/download.ready
elif [ "$CRAFTBUKKITUPTODATEP" = "1" ]; then
echo "Cleaning temporary Plugins"
rm -rf "$DIR1"/bukkit_update/plugins/.jar "$DIR1"/bukkit_update/plugins/.zip "$DIR1"/bukkit_update/plugins/.html "$DIR1"/bukkit_update/plugins/plugin.ready "$DIR1"/bukkit_update/plugins/plugin.fail
fi
if [ "$BKUPOLD" = "1" ]; then
echo "Cleaning old Backups"
find $BKUP -type f -mtime +$BKUPOLDT -delete
fi
}
MULTISERVER_UP() {
echo "Backing up current binaries..."
cd "$DIR1"
tar -czf "$NAME1"-"$DATE".tar.gz plugins/ craftbukkit.jar server.log full_server.log
mv "$NAME1"-"$DATE".tar.gz "$BKUP"
if [ "$BKUPWORLD1" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME1" ]; then
mkdir "$BKUP"/"$WORLDNAME1"
fi
tar -czf "$NAME1"-"$DATE".tar.gz "$WORLDNAME1"/
mv "$NAME1"-"$DATE".tar.gz "$BKUP"
fi
if [ "$BKUPNETHER1" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME1" ]; then
mkdir "$BKUP"/"$WORLDNAME1"
fi
tar -czf "$NAME1"_nether-"$DATE".tar.gz "$WORLDNAME1"_nether/
mv "$NAME1"_nether-"$DATE".tar.gz "$BKUP"/"$WORLDNAME1"/
fi
cd "$DIR2"
tar -czf "$NAME2"-"$DATE".tar.gz plugins/ craftbukkit.jar server.log full_server.log
mv "$NAME2"-"$DATE".tar.gz "$BKUP"
if [ "$BKUPWORLD2" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME2" ]; then
mkdir "$BKUP"/"$WORLDNAME2"
fi
tar -czf "$NAME2"-"$DATE".tar.gz "$WORLDNAME2"/
mv "$NAME2"-"$DATE".tar.gz "$BKUP"
fi
if [ "$BKUPNETHER2" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME2" ]; then
mkdir "$BKUP"/"$WORLDNAME2"
fi
tar -czf "$NAME2"_nether-"$DATE".tar.gz "$WORLDNAME2"_nether/
mv "$NAME2"_nether-"$DATE".tar.gz "$BKUP"/"$WORLDNAME2"/
fi
echo "done"
if [ "$CRAFTBUKKITUPTODATEB" = "1" ]; then
echo "Downloading Bukkit"
screen -dr "$NAME1" -p 0 -X stuff "$(printf "uptodate update\r")"
until [ -e "$DIR1/bukkit_update/download.ready" ]; do
for c in $(seq 1 5); do
echo -n "."
sleep 5
done
if [ -e "$DIR1/bukkit_update/download.fail" ]; then
break
BUKKITUP="fail"
fi
done
echo !
if [ -e "$DIR1/bukkit_update/download.ready" ]; then
BUKKITUP="ok"
else
echo "No Bukkit Update"
fi
fi
if [ "$CRAFTBUKKITUPTODATEP" = "1" ]; then
echo "Downloading Plugin Updates..."
screen -dr "$NAME1" -p 0 -X stuff "$(printf "uptodate plugin\r")"
screen -dr "$NAME2" -p 0 -X stuff "$(printf "uptodate plugin\r")"
until [ "$PLDMC1" = "ok" ] && [ "$PLDMC2" = "ok" ]; do
if [ -e "$DIR1/bukkit_update/plugins/plugin.ready" ]; then
PLDMC1="ok"
elif [ -e "$DIR1/bukkit_update/plugins/plugin.fail" ]; then
PLDMC1="fail"
fi
if [ -e "$DIR2/bukkit_update/plugins/plugin.ready" ]; then
PLDMC2="ok"
elif [ -e "$DIR2/bukkit_update/plugins/plugin.fail" ]; then
PLDMC2="fail"
fi
for c in $(seq 1 5); do
echo -n "."
sleep 5
done
if [ "$PLDMC1" = "fail" ] && [ "$PLDMC2" = "fail" ]; then
break
fi
if [ "$PLDMC1" = "fail" ] && [ "$PLDMC2" = "ok" ]; then
break
fi
if [ "$PLDMC1" = "ok" ] && [ "$PLDMC2" = "fail" ]; then
break
fi
done
echo !
if [ "$PLDMC1" = "ok" ] && [ "$PLDMC2" = "ok" ]; then
echo "Copy updates in the plugin Folder? (yes/no)"
read pcopy
if [ "$pcopy" = "yes" ] ; then
if [ "$BUKKITUP" = "ok" ] ; then
echo "Update Bukkit..."
cp "$DIR1"/bukkit_update/craftbukkit.jar "$DIR1"
cp "$DIR1"/bukkit_update/craftbukkit.jar "$DIR2"
chmod 777 "$DIR1"/craftbukkit.jar
chmod 777 "$DIR2"/craftbukkit.jar
else
echo "No Bukkit Update"
fi
echo "Update $DESC1 Plugins..."
cp -r "$DIR1"/bukkit_update/plugins/.jar "$DIR1"/plugins/
echo "done"
echo "Update $DESC2 Plugins..."
cp -r "$DIR2"/bukkit_update/plugins/.jar "$DIR2"/plugins/
echo "done"
PLCP1="ok"
PLCP2="ok"
RESTARTSERVER="yes"
else
echo "Updates are in the $DIR1/bukkit_update/plugins Folder"
fi
elif [ "$PLDMC1" = "ok" ]; then
echo "Copy updates in the plugin Folder? (yes/no)"
read pcopy1
if [ "$pcopy1" = "yes" ] ; then
if [ "$BUKKITUP" = "ok" ] ; then
echo "Update Bukkit..."
cp "$DIR1"/bukkit_update/craftbukkit.jar "$DIR1"
cp "$DIR1"/bukkit_update/craftbukkit.jar "$DIR2"
chmod 777 "$DIR1"/craftbukkit.jar
chmod 777 "$DIR2"/craftbukkit.jar
else
echo "No Bukkit Update"
fi
echo "Update $DESC1 Plugins..."
cp -r "$DIR1"/bukkit_update/plugins/.jar "$DIR1"/plugins/
echo "done"
echo "$DESC2 have no Plugin updates"
PLCP1="ok"
RESTARTSERVER="yes"
else
echo "Updates are in the $DIR1/bukkit_update/plugins Folder"
fi
elif [ "$PLDMC2" = "ok" ]; then
echo "Copy updates in the plugin Folder? (yes/no)"
read pcopy2
if [ "$pcopy2" = "yes" ] ; then
if [ "$BUKKITUP" = "ok" ] ; then
echo "Update Bukkit..."
cp "$DIR1"/bukkit_update/craftbukkit.jar "$DIR1"
cp "$DIR1"/bukkit_update/craftbukkit.jar "$DIR2"
chmod 777 "$DIR1"/craftbukkit.jar
chmod 777 "$DIR2"/craftbukkit.jar
else
echo "No Bukkit Update"
fi
echo "$DESC1 have no Plugin updates"
echo "Update $DESC2 Plugins..."
cp -r "$DIR2"/bukkit_update/plugins/.jar "$DIR2"/plugins/
echo "done"
PLCP2="ok"
RESTARTSERVER="yes"
else
echo "Updates are in the $DIR1/bukkit_update/plugins Folder"
fi
else
echo "$DESC1 & $DESC2 have no Plugin updates"
RESTARTSERVER="no"
fi
fi
if [ "$CRAFTBUKKITUPTODATEB" = "1" ] && [ "$CRAFTBUKKITUPTODATEP" = "1" ]; then
echo "Cleaning temporary Plugins"
rm -f "$DIR1"/full_server.log "$DIR2"/full_server.log
rm -f "$DIR1"/bukkit_update/craftbukkit.jar "$DIR1"/bukkit_update/download.fail "$DIR1"/bukkit_update/download.ready
rm -rf "$DIR1"/bukkit_update/plugins/.jar "$DIR1"/bukkit_update/plugins/.zip "$DIR1"/bukkit_update/plugins/.html "$DIR1"/bukkit_update/plugins/plugin.ready "$DIR1"/bukkit_update/plugins/plugin.fail
rm -rf "$DIR2"/bukkit_update/plugins/.jar "$DIR2"/bukkit_update/plugins/.zip "$DIR2"/bukkit_update/plugins/.html "$DIR2"/bukkit_update/plugins/plugin.ready "$DIR2"/bukkit_update/plugins/plugin.fail
elif [ "$CRAFTBUKKITUPTODATEB" = "1" ]; then
echo "Cleaning temporary Plugins"
rm -f "$DIR1"/full_server.log "$DIR2"/full_server.log
rm -f "$DIR1"/bukkit_update/craftbukkit.jar "$DIR1"/bukkit_update/download.fail "$DIR1"/bukkit_update/download.ready
elif [ "$CRAFTBUKKITUPTODATEP" = "1" ]; then
echo "Cleaning temporary Plugins"
rm -f "$DIR1"/full_server.log "$DIR2"/full_server.log
rm -rf "$DIR1"/bukkit_update/plugins/.jar "$DIR1"/bukkit_update/plugins/.zip "$DIR1"/bukkit_update/plugins/.html "$DIR1"/bukkit_update/plugins/plugin.ready "$DIR1"/bukkit_update/plugins/plugin.fail
rm -rf "$DIR2"/bukkit_update/plugins/.jar "$DIR2"/bukkit_update/plugins/.zip "$DIR2"/bukkit_update/plugins/.html "$DIR2"/bukkit_update/plugins/plugin.ready "$DIR2"/bukkit_update/plugins/plugin.fail
fi
if [ "$BKUPOLD" = "1" ]; then
echo "Cleaning old Backups"
find $BKUP -type f -mtime +$BKUPOLDT -delete
fi
}
case "$1" in
cron)
if [ "$SERVER" = "2" ]; then
if [ ! -d "$BKUP" ]; then
mkdir "$BKUP"
fi
cd "$DIR1"
tar -czf "$NAME1"-"$DATE".tar.gz plugins/ craftbukkit.jar server.log full_server.log
mv "$NAME1"-"$DATE".tar.gz "$BKUP"
if [ "$BKUPWORLD1" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME1" ]; then
mkdir "$BKUP"/"$WORLDNAME1"
fi
tar -czf "$NAME1"-"$DATE".tar.gz "$WORLDNAME1"/
mv "$NAME1"-"$DATE".tar.gz "$BKUP"/"$WORLDNAME1"/
fi
if [ "$BKUPNETHER1" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME1" ]; then
mkdir "$BKUP"/"$WORLDNAME1"
fi
tar -czf "$NAME1"_nether-"$DATE".tar.gz "$WORLDNAME1"_nether/
mv "$NAME1"_nether-"$DATE".tar.gz "$BKUP"/"$WORLDNAME1"/
fi
cd "$DIR2"
tar -czf "$NAME2"-"$DATE".tar.gz plugins/ craftbukkit.jar server.log full_server.log
mv "$NAME2"-"$DATE".tar.gz "$BKUP"
if [ "$BKUPWORLD2" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME2" ]; then
mkdir "$BKUP"/"$WORLDNAME2"
fi
tar -czf "$NAME2"-"$DATE".tar.gz "$WORLDNAME2"/
mv "$NAME2"-"$DATE".tar.gz "$BKUP"/"$WORLDNAME2"/
fi
if [ "$BKUPNETHER2" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME2" ]; then
mkdir "$BKUP"/"$WORLDNAME2"
fi
tar -czf "$NAME2"_nether-"$DATE".tar.gz "$WORLDNAME2"_nether/
mv "$NAME2"_nether-"$DATE".tar.gz "$BKUP"/"$WORLDNAME2"/
fi
else
if [ ! -d "$BKUP"/"$WORLDNAME1" ]; then
mkdir "$BKUP"/"$WORLDNAME1"
fi
cd "$DIR1"
tar -czf "$NAME1"-"$DATE".tar.gz plugins/ craftbukkit.jar server.log
mv "$NAME1"-"$DATE".tar.gz "$BKUP"
if [ "$BKUPWORLD1" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME1" ]; then
mkdir "$BKUP"/"$WORLDNAME1"
fi
tar -czf "$NAME1"-"$DATE".tar.gz "$WORLDNAME1"/
mv "$NAME1"-"$DATE".tar.gz "$BKUP"/"$WORLDNAME1"/
fi
if [ "$BKUPNETHER1" = "1" ]; then
if [ ! -d "$BKUP"/"$WORLDNAME1" ]; then
mkdir "$BKUP"/"$WORLDNAME1"
fi
tar -czf "$NAME1"_nether-"$DATE".tar.gz "$WORLDNAME1"_nether/
mv "$NAME1"_nether-"$DATE".tar.gz "$BKUP"/"$WORLDNAME1"/
fi
fi
if [ "$CRONBKUPOLD" = "1" ]; then
echo "Cleaning old Backups"
find $BKUP -type f -mtime +$BKUPOLDT -delete
fi
exit 1
;;
autorr)
RRB || exit 1
;;
)
while :
do
clear
echo " M A I N - M E N U"
echo "$DESC1"
echo "1. Start $DESC1"
echo "2. Stop $DESC1"
echo "3. Restart $DESC1"
echo "4. Say on $DESC1"
echo "5. Login into $DESC1"
if [ "$SERVER" = "2" ]; then
echo "$DESC2"
echo "6. Start $DESC2"
echo "7. Stop $DESC2"
echo "8. Restart $DESC2"
echo "9. Say on $DESC2"
echo "10. Login into $DESC2"
echo "Generally Options"
echo "11. Restart Both"
echo "12. Serverstatus"
echo "13. Update"
echo "14. Exit"
echo -n "Please enter option [1 - 14]"
else
echo "12. Serverstatus"
echo "13. Update"
echo "14. Exit"
echo -n "Please enter option [1 - 5 & 12 - 14]"
fi
read opt
case $opt in
1) STARTS1
exit 1;;
2) STOPS1
exit 1;;
3) RESTARTS1
exit 1;;
4) echo "You are going to write on the Server:";
read say1
SAYS1
exit 1;;
5) SCREENS1
exit 1;;
6) STARTS2
exit 1;;
7) STOPS2
exit 1;;
8) RESTARTS2
exit 1;;
9) echo "You are going to write on the Server:";
read say2
SAYS2
exit 1;;
10) SCREENS2
exit 1;;
11) RRB
exit 1;;
12) STATUS
exit 1;;
13) UPDATE;;
14) echo "Bye $USER";
exit 1;;
*) echo "$opt is an invaild option.";
if [ "$SERVER" = "2" ]; then
echo -n "Please select option between [1 - 13] only";
else
echo -n "Please select option between [1 - 5 & 12 - 14] only";
fi
echo "Press [enter] key to continue. . .";
read enterKey;;
esac
done
esac
So, when we log into the back-end, and type "sh stargserver.sh" it brings us to a page with a bunch of options. It's smart enough to update the system, and not let you do anything stupid to break things. I think I may do some work to clean it up when we move, but this is how it exists now.
When you pay someone to host your minecraft server, and it's someone that has a specific "run minecraft server" business, they have some sort of a website GUI that controls a lot of these commands, which is what we used to use. Remember back in the day having to wait for the host to allow us to use dev bukkit versions? It's just less control, for our purposes, running the server on a blank linux system is much better.
This entry was posted on Thursday, October 11th, 2012 at 6:49 pm by surfrock66 and is filed under Owner's Corner.
You can leave a response, or trackback from your own site.
2 Responses to “Owner’s Corner: Start Script”
Well I see your problem… you’ve got to START the server, not STARG it!
Most of that stuff is unused garbage that doesnt work. it needs to be pruned.