IntroductionWe've been using the linux startup script from the minecraft wiki for some time now and generally it works a treat, but recently I've wanted to set up a second service for my two younger sons to play on, away from the highly modified worlds that my oldest son had set up. The script can't cope with two services running at the same time, but with a few tweaks you can run as many as you like. The following instructions create a new game server called Pinga using a service called kidcraft.
Creating the New Minecraft InstallationI wanted it use vanilla Minecraft version 1.5.2, which was the very first version that we tried, but it should work for any version including craftbukkit, or any other modded versions.
1. Make a copy of your existing Minecraft installation.
cp -Rv /opt/minecraft /opt/kidcraft
2. Remove the old world directories (in my case the world was called 'Plop')
rm -R Plop
3. Edit your server.properties file and change the following settings:-
- server-port : 25566 (the default is 25565 so pick a number that isn't being used)
-server-name : Pinga (enter your new server name)
- level-name : Pinga (will be used to name your new world)
- gamemode : 1 (Creative - my kids don't want to play survival, you can leave this as 0)
Also make sure the other settings are set back if altered from standard.
4. Empty the Ops, Banned-ip, Banned-players and White-list files or delete them (they'll get recreated when you start the server).
5. Start the server up and allow it to create a new world.
6. Check you can connect to it in the game using the Multiplayer option.
7. Close down the server.
Create a New Backup FolderIf you use the backup option then you want to specify a new location for the files so they don't get mixed in with your existing backups. Mine were going into the /DailyBackup/Minecraft folder.
8. Go to your backup folder and create a new sub-directory
Modifying the Startup ScriptThe startup script uses the 'screen' utility as the control mechanism, and this also allows you to access the console if required. You will need to make some changes to the new script so that the commands connect to the correct service.
9. Copy the startup script
cp /etc/init.d/minecraft /etc/init.d/kidcraft
10. Ensure it can be executed
chmod 755 /etc/init.d/kidcraft
11. Edit the new startup script and modify the following:-
- WORLD : 'Pinga'
- MCPATH : '/opt/kidcraft'
- BACKUPPATH : '/DailyBackup/kidcraft'
12. Then alter the startup line in the mc_start() function
as_user "cd $MCPATH && screen -h $HISTORY -dmS kidcraft $INVOCATION"
13. Repeat stage 12 for the following functions:-
14. Save and exit the file.
You should be able to start and stop the new service using this new script in the normal way.
eg. /etc/init.d/kidcraft start
You can also access the console using the following command.
screen -r -S kidcraft
(Nb. use Ctrl + A D to exit)