One could make a bash script to check the port availability and only start  
the server if it is free. Something like this:


#!/bin/bash

PORT=27015

if [[ $(netstat -nul | grep $PORT) ]]
then
     echo "Port $PORT already in use, not starting SRCDS"
else
     ./srcds_run $*
fi


Now instead of using srcds_run directly, you would call this script. Of  
course you can customize it to your heart's contents as you see fit.


On Tue, 08 Jun 2010 21:40:37 +0300, clad iron <[email protected]> wrote:

> i'm not following 100% but if i do understand right.
> Your wanting to see if a port is already in use ?
>
> 1 easy way if you already have another server installed. you could just
> start it up on the port in question and watch the console output. it will
> tell you if it's already in use, but at that point it WILL pick another  
> port
> and continue to load up.
>
>
> On Mon, Jun 7, 2010 at 7:42 AM, kama <[email protected]> wrote:
>
>>
>> Hi!
>>
>> Is there an option for srcds based games not to change the port number
>> when the port is used on start?
>>
>> I just want it to tell me that the port is allready in use and quit.
>>
>> /Bjorn
>>
>> _______________________________________________
>> To unsubscribe, edit your list preferences, or view the list archives,
>> please visit:
>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux
>>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,  
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlds_linux

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlds_linux

Reply via email to