[cod] Start COD4 Linux Dedicated via Webinterface

[FnG] Lambik fng.lambik at gmail.com
Sun Dec 13 16:37:52 EST 2009


I think what Ollie says a permission problem,
 the webserver run on a certain user, and does that user have the right
permissions on the CoD4 server files ?
Do you have SUEXEC on the webserver enabled ?
btw, add the 2> output to it aswell ;)

system('/home/me/gameserver.sh cod4 start 1> /home/me/gameserver-log
2>/home/me/gameerrorlog', $status);

Lambik

On Sun, Dec 13, 2009 at 10:18 PM, Ollie Camp <ollie.camp at gmail.com> wrote:

> Sounds like its a permission problem...
>
> It might be that php is running as either root or nobody (depending on how
> your apache is setup and php).
>
> Try calling the script like this.
> system('/home/me/gameserver.sh cod4 start > /home/me/gameserver-log',
> $status);
>
> That will dump any terminal input into a text file which you can thn view
> to see if it chucks any errors out (ie permission problems)
>
> Hope that makes sense?
>
> I personally have complied php with ssh2 and just get my webscript to login
> on ssh as the correct user and then start the server into screen.  Then when
> i want it shutdown it logs back in and kills the screen session. Advantage
> of using screen is that i can logina s the use and check weather
>
>
>
> 2009/12/13 B.M. Schiltmans <b.m.schiltmans at planet.nl>
>
> Not sure if it's going to be much use, but here we go.
>> Script is called rotatecod4 and without arguments it (re)starts cod4. When
>> supplied with 'stop-only' as argument it ... just stops the server.
>> I added some extra comment-lines to make it a bit readable. Could have
>> removed a few lines, but I just wanted to show off ;-)
>>
>> #!/bin/sh
>> # kill the running server, if any
>> killall cod4_lnxded-bin
>> # move the logfile for our stats-pages
>> chmod o+rw /home/games/.callofduty4/mods/lanparty/Server1_mp.log
>> mv /home/games/.callofduty4/mods/lanparty/Server1_mp.log
>> /home/games/logfiles/cod4/`date +%d-%m-%y_%T.log`
>>
>> if [ ! "$1" = "stop-only" ]; then
>>  # call scripts that allows auto-balancing of teams bases on statistics
>> for stats-pages (very nice if I may say so ;-) )
>>  /home/games/csscripts/teamgenerator.sh cod4
>>  # change to right directory
>>  cd /home/games/cod4/
>>  # get a random map to start with
>>  cp /home/games/cod4/maplist.txt_org /home/games/cod4/maplist.txt
>>  ls /home/games/cod4/usermaps >> /home/games/cod4/maplist.txt
>>  STARTMAP=`php /home/games/csscripts/shuffle_file.php
>> /home/games/cod4/maplist.txt /home/games/cod4/maplist.txt`
>>  # start the server
>>  screen -d -m /home/games/cod4/cod4_lnxded-bin +set dedicated 1 +exec
>> hardcore.cfg +map_rotate +map $STARTMAP +set fs_game mods/lanparty
>>  # start an extra script that auto-switches players in teamspeak based on
>> the team they are currently in
>>  /home/games/csscripts/rotatetsas.sh
>> /home/games/.callofduty4/mods/lanparty/Server1_mp.log
>> fi
>>
>>
>> Grtz
>> Bram
>>
>>
>> Taraman wrote:
>>
>>> Hi Bram,
>>>
>>> WOW, I'm impressed. That is one nice piece of work.
>>>
>>> As for my problem:
>>> I use cod4_lnxded as executable, but also tried the -bin already.
>>> The command line is right now:
>>> +exec server.cfg +map mp_crash +set dedicated 1
>>>
>>> options I also tried:
>>> +set fs_homepath
>>> +set fs_basepath
>>>
>>> What is your commandline for a LAN-Setup?
>>>
>>> For my part I chose direct control because it should stay simple and
>>> mainly be a backup when I cannot visit myself at one of our meetings (we are
>>> normally around 8-10 people). So this really is a private use thing.
>>>
>>> Taraman
>>>
>>> On 11.12.2009 20:11, B.M. Schiltmans wrote:
>>>
>>>> If the others run fine, I can't really think of anything cod-specific
>>>> that could go wrong.
>>>> Which executeable do you see in top cod4_lnxded or cod4_lnxded-bin, and
>>>> whats you exact command-line?
>>>>
>>>> We have a setup quite like yours, perhaps we could share some ideas?
>>>> To begin with some sharing ;-), take a look here :
>>>> http://lanparty.cil.nu/
>>>> Instead of starting the gameservers through a webinterface, we let
>>>> players vote for which game they want to play, and then a scripts is run to
>>>> count the votes and start the winning game. Works great ;-)
>>>> Two main reasons for not having direct control:
>>>> - security, we run the same thing on lans, but also on our website for
>>>> evening fun
>>>> - we only run one gameserver at a time because otherwise people tent to
>>>> spread out over games more instead of playing together.
>>>> Af course it all depends on how big your lan-events are.
>>>>
>>>> Grtz
>>>> Bram
>>>>
>>>> Taraman wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Thx for the comments.
>>>>> First of all: Security is not an issue here, because its a LAN-only
>>>>> server and at the Site we do our LAN-Parties (me and some Friends) we don't
>>>>> even have Internet. Yes, there are places like that - honestly ;-)
>>>>> Nevertheless the gameserver is started as a "normal" user and the
>>>>> Webserver runs as the same user - NOT as root.
>>>>> And I wouldn't do it that way on a public machine - to calm your
>>>>> apprehension.
>>>>>
>>>>> As for Bram's comment:
>>>>> Good hint, I definitely have a closer look at that.
>>>>> But I fear thats not the problem, because of a fact that I forgot in
>>>>> the description:
>>>>> I start two other Gameservers (CSS and BF2) via the exact same script
>>>>> and checked severeal times the calls are really identical.
>>>>> These two work perfectly.
>>>>> Only the cod4 server starts very shortly (it just shows up for a moment
>>>>> in "top" and then disappears again.)
>>>>>
>>>>> Thats why I started asking here, bacause it seems to be beacuse of
>>>>> something thats different on the cod-server.
>>>>>
>>>>> Taraman
>>>>>
>>>>> Tyson schrieb:
>>>>>
>>>>>> Yes please. Including system paths that are typically the same on
>>>>>> every
>>>>>> machine running the same OS isn't insecure last I knew.
>>>>>>
>>>>>> Setting wrong permissions on the other or running as root is.
>>>>>>
>>>>>> So please enlighten us and provide sources.
>>>>>>
>>>>>> Tyson
>>>>>>
>>>>>>
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: B.M. Schiltmans [mailto:b.m.schiltmans at planet.nl] Sent:
>>>>>> Wednesday, December 09, 2009 10:12 AM
>>>>>> To: Call of Duty server admin list.
>>>>>> Subject: Re: [cod] Start COD4 Linux Dedicated via Webinterface
>>>>>>
>>>>>> Well if you explain yourself a bit further we might just learn
>>>>>> something here.
>>>>>> Humor me, plz...
>>>>>>
>>>>>> Marco Padovan wrote:
>>>>>>
>>>>>>> that's a very insecure way to start gameservers :/
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Dec 9, 2009 at 3:55 PM, <b.m.schiltmans at planet.nl <mailto:
>>>>>>> b.m.schiltmans at planet.nl>> wrote:
>>>>>>>
>>>>>>>    Sound like a problem with uninitialized (system)variables. When a
>>>>>>>    command is started through php, it doesn't load your profile and
>>>>>>>    therefor things like your path are not set. Try including paths on
>>>>>>>    all commands, so /usr/bin/screen instead of just screen.
>>>>>>>
>>>>>>>    Hope that helps.
>>>>>>>    Grtz
>>>>>>>    Bram
>>>>>>>
>>>>>>>
>>>>>>>    -----Oorspronkelijk bericht-----
>>>>>>>    Van: Taraman [mailto:Taraman at gmx.de]
>>>>>>>    Verzonden: wo 9-12-2009 13:54
>>>>>>>    Aan: cod at icculus.org <mailto:cod at icculus.org>
>>>>>>>    Onderwerp: [cod] Start COD4 Linux Dedicated via Webinterface
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>    Hi,
>>>>>>>
>>>>>>>    I'm just programming a Webinterface for our LAN-server.
>>>>>>>    My problem is, that the cod4 server does not start via the
>>>>>>>    Webinterface.
>>>>>>>
>>>>>>>    I have a Shell-script called gameserver.sh that starts the
>>>>>>> different
>>>>>>>    servers via "/somedir/gameserver.sh cod4 start"
>>>>>>>    This script works fine when used from a terminal - also if called
>>>>>>> from
>>>>>>>    different directories. The Server itself is then running like a
>>>>>>> charm.
>>>>>>>    The Script basically changes the directory to the game directory
>>>>>>>    via "cd
>>>>>>>    /home/me/cod4" and then launches the server with Screen -dmS
>>>>>>>
>>>>>>>    In the Webinterface the script is called by PHP with
>>>>>>>    "System('/home/me/gameserver.sh cod4 start', $status);"
>>>>>>>    With this the Script says "Server Started" and the program is
>>>>>>>    launched,
>>>>>>>    but the process dies again immediately.
>>>>>>>
>>>>>>>    I have a hard time debugging the error, because I don't get any
>>>>>>> error
>>>>>>>    messages. The server does not live long enough to write a log and
>>>>>>> the
>>>>>>>    PHP System command does not give me any useful output (I also
>>>>>>> tried to
>>>>>>>    start the server directly).
>>>>>>>
>>>>>>>    Does anyone have an Idea, what the problem is, or how I can get
>>>>>>> useful
>>>>>>>    error Information?
>>>>>>>
>>>>>>>    Taraman
>>>>>>>
>>>>>>>    _______________________________________________
>>>>>>>    cod mailing list
>>>>>>>    cod at icculus.org <mailto:cod at icculus.org>
>>>>>>>    http://icculus.org/mailman/listinfo/cod
>>>>>>>
>>>>>>>
>>>>>>>    _______________________________________________
>>>>>>>    cod mailing list
>>>>>>>    cod at icculus.org <mailto:cod at icculus.org>
>>>>>>>    http://icculus.org/mailman/listinfo/cod
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> cod mailing list
>>>>>>> cod at icculus.org
>>>>>>> http://icculus.org/mailman/listinfo/cod
>>>>>>>
>>>>>> _______________________________________________
>>>>>> cod mailing list
>>>>>> cod at icculus.org
>>>>>> http://icculus.org/mailman/listinfo/cod
>>>>>>
>>>>>> No virus found in this incoming message.
>>>>>> Checked by AVG - www.avg.com Version: 9.0.709 / Virus Database:
>>>>>> 270.14.101/2555 - Release Date: 12/09/09
>>>>>> 12:41:00
>>>>>>
>>>>>> _______________________________________________
>>>>>> cod mailing list
>>>>>> cod at icculus.org
>>>>>> http://icculus.org/mailman/listinfo/cod
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> cod mailing list
>>>>> cod at icculus.org
>>>>> http://icculus.org/mailman/listinfo/cod
>>>>>
>>>> _______________________________________________
>>>> cod mailing list
>>>> cod at icculus.org
>>>> http://icculus.org/mailman/listinfo/cod
>>>>
>>>>  _______________________________________________
>>> cod mailing list
>>> cod at icculus.org
>>> http://icculus.org/mailman/listinfo/cod
>>>
>>>  _______________________________________________
>> cod mailing list
>> cod at icculus.org
>> http://icculus.org/mailman/listinfo/cod
>>
>
>
>
> --
> Ollie
>
> _______________________________________________
> cod mailing list
> cod at icculus.org
> http://icculus.org/mailman/listinfo/cod
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/cod/attachments/20091213/6d2340a1/attachment.htm>


More information about the cod mailing list