[Server] Scripts

vlncvlnc Join Date: 2010-09-07 Member: 73921Members, Squad Five Blue
edited June 2011 in NS2 General Discussion
<div class="IPBDescription">Some scripts to launch server</div>Hi, may this can help people to launch your server on ns2.

<a href="http://www.unknownworlds.com/ns2/forums/index.php?showtopic=112026" target="_blank">NS2-GmOvrmind</a> (-game C:\ns2server\NS2GmOvrmind) ty player
<a href="http://www.unknownworlds.com/ns2/forums/index.php?showtopic=113414" target="_blank">Automatic Updates</a> (ns2update.exe) ty devicenull

Here are my scripts :

[Windows]

restart.bat :

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->@echo OFF

echo "Kill server.exe and ns2update.exe"

taskkill /F /IM server.exe
taskkill /F /IM ns2update.exe

echo "Lancement Serveur"

cd C:\ns2server

ns2update.exe -file C:\ns2server\server.xml -ip 88.190.18.171 --restartwhenempty -game C:\ns2server\NS2GmOvrmind

REM start /AFFINITY 3 server.exe -file C:\ns2server\server.xml -game C:\ns2server\NS2GmOvrmind<!--c2--></div><!--ec2-->

[CentOS (linux)]

ns2restart :

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->#/bin/bash

echo -e "\n##########################################"
echo "### SERVER RESTART NATURAL SELECTION 2 ###"
echo "##########################################"

echo -e "\nVerification process server.exe"

servergrep=`pgrep -l server.exe`

if [ "$servergrep" ]; then
    echo -e "\nLe serveur va etre arreter"
    pkill server.exe
    echo -e "\nRedemarrage du serveur ns2\n"
    screen -dmS ns2restart wine server.exe -file server.xml -game NS2GmOvrmind
else    
    echo "\Le serveur n'est pas demarre"
    sleep 1
    clear
    exit
fi<!--c2--></div><!--ec2-->

About the screen software for people who don't know what it is, screen is a full-screen window manager. Like i'm launching the script in terminal window, it's good to detach and reattach your window. (<a href="http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/" target="_blank">more informations here</a>)

Comments

  • MOOtantMOOtant Join Date: 2010-06-25 Member: 72158Members
    I'd like to have combo like: ns2update -> start /AFFINITY -> server.exe. But at the moment ns2update doesn't execute a script, it just executes server.exe directly.
  • vlncvlnc Join Date: 2010-09-07 Member: 73921Members, Squad Five Blue
    edited June 2011
    I tried to use ns2update but the problem is I can't launch overmind in the same time.

    Have you got a working command launch with ns2update + server.xml +overmind ?
  • devicenulldevicenull Join Date: 2003-04-30 Member: 15967Members, NS2 Playtester, Squad Five Blue
    Or you know, you could just use my <a href="http://www.unknownworlds.com/ns2/forums/index.php?showtopic=113414" target="_blank">automatic updater</a>
  • vlncvlnc Join Date: 2010-09-07 Member: 73921Members, Squad Five Blue
    I was talking about your automatic updater devicenull :)
  • devicenulldevicenull Join Date: 2003-04-30 Member: 15967Members, NS2 Playtester, Squad Five Blue
    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->ns2update.exe -game NS2GmOvrmind<!--QuoteEnd--></div><!--QuoteEEnd--> is what I use, and it works fine
  • vlncvlnc Join Date: 2010-09-07 Member: 73921Members, Squad Five Blue
    edited June 2011
    you don't need to add server.xml options too ? just asking

    edit : ok I added -file server.xml and it works great now with your mod ty devicenull
Sign In or Register to comment.