Posted: Thu Jan 14, 2010 7:06 pm Post subject: Setting supw AND starting mumble
Hello, I've run into a tough problem.
I create mumble servers automatically for my clients on linux hosts, so I need gamecreate to do 2 things :
start murmur with supw command (which doesn't launch the server, it just starts, sets it's database and dies).
AND after that (or before for that matters) start the server itself
Code:
./murmur.x86 -ini port%server:port%.ini
I've noticed that gamecreate only allows one command, so I wrote a wrapper script that I renamed as murmur.x86
The big problems come here :
Gamecreate seems to be monitoring the script it launches. That means, I can't just launch my commands and let my wrapper die or else gamecreate will restart it endlessly and create many useless clone servers.
So, I need my wrapper to run as long as the mumble server runs.
I first thought the wait command would do the trick, but no :
when you launch mumble, it launches another process and dies itself. So the REAL mumble server, the one we want to check is not using the pid of the ./murmur.x86 we just launched
I've found a way to get past this one : you use this command :
Code:
strace -q -e '' -s 0 -p $pid && echo 'finished!'
To get the $pid you have to add the following line to your script :
Code:
pid=`cat murmur$2.pid`;
$2 being the second argument I call my wrapper script with, the server port
To get mumble to create this .pid file, you have to edit your ini and add the following line :
So basically I can make my wrapper run and wait for mumble to die.
BUT there still is a problem : while gamecreate is able to launch the server and set the password, it cannot kill the server. Gamecreate kills my wrapper, but not the real mumble server.
I've tried the trap command, which allows your script to catch the signal you want (e.g. SIGTERM which is sent when you do a CTRL + C to kill the running script). Here's one :
This means when you send a kill (normally it sends the signal 5) to my wrapper, It'll kill the mumble server using pid (which we got earlier in a variable)
I've added many trap with different signals, it works when YOU launch the wrapper yourself and kill it with CTRL+C but it doesn't when GC starts it and kills it.
I'll post my complete script so you guys can check what's wrong.
So this wrapper script is supposed to be called with two arguments :
$1 is the supassword and $2 is the port number
Since gamecreate calls murmur.x86 I've had to rename the REAL murmur into murmur_orig.x86, and rename this script as murmur.x86
So, what in the world is wrong with my script ? does gamecreate use a signal that I'm unaware of to kill a program ?
I'd really appreciate your help here, I've been searching for this for days now.
Thanks in advance
I think I found the solution, but it only run on gamecreate as root.
you might run this script with 3 arguments
1st : the super user password (in gamecreate %supassword%)
2nd : the server id (in gamecreate %server:id%)
3rd : the user which have rights on the murmur files
Have you checked the owner of the mumble files? I suppose that if the file
which stores the password is owned by root, you may not be able to change
it unless you run mumble as root.
Posted: Wed Feb 17, 2010 4:12 pm Post subject: Re: Setting supw AND starting mumble
"Gamecreate seems to be monitoring the script it launches. That means, I can't just launch my commands and let my wrapper die or else gamecreate will restart it endlessly and create many useless clone servers. "
A work-around for this is to tick 'Require a screen' under Game Configuration.
This will make GameCreate start a screen session before starting your wrapper script.
Then the wrapper script may exit; as GameCreate will now monitor the screen itself - not what's running inside it.
The command line issue is a known bug in GameCreate client for Linux, I've jotted it down as a problem and I will see if there is some time to try and fix this - no guarantees at the moment though, sorry.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum