Ahtenus / minecraft-init

Init script for minecraft and bukkit servers
404 stars 124 forks source link

Using the init script to manage multiple servers on a single machine #44

Open Remanent opened 12 years ago

Remanent commented 12 years ago

I have been using your script to run a single server on a single machine, and i wanted to use a second copy of the script (mc1 and mc2 for this example) so that i could have a test server running in conjunction with the live server, that i can test plugins on, etc, without having to affect the main server.

the issue i've run into is if i'm running the script (mc2) for the main server, mc1 sees it online even though i've defined everything different in the config files for the servers.

server 1's config1 file

CB_JAR="craftbukkit_server.jar"
SERVICE=$CB_JAR
CB_RELEASE="stable"
SCREEN="mctest"
USERNAME="v"
MCPATH="/home/${USERNAME}/minecraft/server1"
CPU_COUNT=1
INITMEM="2048M"
MAXMEM="2048M"
INVOCATION="java -Xmx$MAXMEM -Xms$INITMEM -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts -jar $SERVICE nogui"
BACKUPPATH="/home/${USERNAME}/minecraft/minebak"
LOGPATH="/home/${USERNAME}/minecraft/logs/server1"
WHOLEBACKUP="/home/${USERNAME}/minecraft/serverbak/server1"
WORLDSTORAGE="${MCPATH}/worldstorage"
BACKUPFORMAT="tar"
RAMDISK="/dev/shm"```

Server 2 config2 file
```MC_JAR="minecraft_server.jar"
CB_JAR="craftbukkit_server.jar"
SERVICE=$CB_JAR
CB_RELEASE="stable"
SCREEN="mclive"
USERNAME="v"
MCPATH="/home/${USERNAME}/minecraft/server2"
CPU_COUNT=1
INITMEM="2048M"
MAXMEM="2048M"
INVOCATION="java -Xmx$MAXMEM -Xms$INITMEM -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts -jar $SERVICE nogui"
BACKUPPATH="/home/${USERNAME}/minecraft/minebak"
LOGPATH="/home/${USERNAME}/minecraft/logs/server2"
WHOLEBACKUP="/home/${USERNAME}/minecraft/serverbak/server2"
WORLDSTORAGE="${MCPATH}/worldstorage"
BACKUPFORMAT="tar"
RAMDISK="/dev/shm"```
Remanent commented 12 years ago

Meh, all i had to do was change up the name of the jar file being used to start the 2nd server, and all my problems disappeared. (server 1 is craftbukkit_server1.jar, and server 2 is craftbukkit_server2.jar)

YocYoc commented 12 years ago

I think the script could be modified to accept more than 1 server running without having to change the jar name. For example, for the moment the "status" argument return a ps command run by the person who run the script, not the user defined in the config file. Perhaps if we add a "as_user" the trick would be done. But my shell skills are not solid enough to make this secure.

Ahtenus commented 12 years ago

It probably could, haven't tried running multiple servers with the script.

Issues that comes to mind

Remanent commented 12 years ago

well, the other idea i had was have the server check look for $SCREEN instead of looking for the $SERVICE.. (defined in SCREEN="screen_naame_goes_here")

Initially, I had created multiple ramdrives, but have since gone to a single ram drive hosting all the worlds and been sure that for the worlds that they were all unique (i'm not running multiverse, yet, so i only have 2 worlds in ram)

Ahtenus commented 12 years ago

Humm, hadn't thought about looking for the screen session, but it seems like i good idea.

Ahtenus commented 12 years ago

Now the script checks for the screen session.

jbondhus commented 11 years ago

This thread should probably be closed if it's solved. It's been open for 8 months.

Leopere commented 11 years ago

I think that I wouldnt mind some more commenting in the script about this but I'm going to try my go at this i'm hoping to dump multicraft on its head running a single command seems much easier to me then clicking through a sloppy webgui.