SRCDS Steam group


[Resolved] Problem with bash script.
#1
(Bad english) I'm trying to make a script for hlds, it work's (start 2 or 3 servers) but each others doesn't run completly.

HLDS says: ./hlds_run: line 321: 25189 Violación de segmento $HL_CMD

my code:
Code:
#!/bin/bash
#-------------------------------------------------------
#-Settings----------------------------------------------
#-------------------------------------------------------
DIR=/home/USER/prueba1
DAEMON='hlds_run';
param='-game cstrike -ip 200.3.44.5 +sys_ticrate 1010 +map de_dust2 -pingboost 3 +fps_max 0';

#-------------------------------------------------------
#-Servers-----------------------------------------------
#-------------------------------------------------------
# Agregar servidores, reemplazar variables con un numero
# diferente.. por ejemplo name1.. name2.. port1.. port2
#-------------------------------------------------------

#Server0
name0='server0';
param0='-port 27015 -maxplayers 14 +exec cfg/server0.cfg';

#Server1
name1='server1';
param1='-port 27045 -maxplayers 14 +exec cfg/server1.cfg';

#Server2
name2='server2';
param2='-port 27060 -maxplayers 14 +exec cfg/server2.cfg';

#Server3
name3='server3';
param3='-port 27030 -maxplayers 12 +exec cfg/server3.cfg';


case "$1" in

start)

    if [[ `screen -ls | grep $name0` ]]
       then
       echo "Server $name0 is already running!";
    else
       cd $DIR;
       echo "Starting Server: $name0";
       chrt -r 98 screen -AmdS $name0 ./$DAEMON $param $param0;
    fi
    
    if [[ `screen -ls | grep $name1` ]]
       then
       echo "Server $name1 is already running!";
    else
       cd $DIR;
       echo "Starting Server: $name1";
       chrt -r 98 screen -AmdS $name1 ./$DAEMON $param $param1;
    fi
    
    if [[ `screen -ls | grep $name2` ]]
       then
       echo "Server $name2 is already running!";
    else
       cd $DIR;
       echo "Starting Server: $name2";
       chrt -r 98 screen -AmdS $name2 ./$DAEMON $param $param2;
    fi
    
    if [[ `screen -ls | grep $name3` ]]
       then
       echo "Server $name3 is already running!";
    else
       cd $DIR;
       echo "Starting Server: $name3";
       chrt -r 98 screen -AmdS $name3 ./$DAEMON $param $param3;
    fi
;;

*)
    echo "Usage: $0 {start|stop}"
    exit 1
;;
    
esac

exit 0
Reply
#2
starting all servers with one script is a bad idea. If only one servers stops you need to restart all servers.
I already mailed you my script. Use a copy of that for every server you want to run.
If you want to start/restart all at once it would be starting all startscript at once.

Code:
#!/bin/bash

./start1.sh start
./start2.sh start
./start3.sh start
Interactive web based config creator for CS, CSS, TF2 and DODS
Creates server and client configs in an explained dialog.

You`ll also find precompiled debian gameserver kernels for download
Reply
#3
if I understand the script correctly it will only start the server that are not yet running, so that would not be a problem - and it wasn't the question...

can you give us the complete output of a hlds or at least the last ~20 lines right before the crash? that "segmentation fault" only says there was a crash, but not why...
http://www.fpsmeter.org
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Reply
#4
Code:
Auto detecting CPU
Using Pentium II Optimised binary.
Auto-restarting the server on crash

Console initialized.
scandir failed:/home/USER/prueba1/./platform/SAVE
Protocol version 48
Exe version 1.1.2.6/Stdio (cstrike)
Exe build: 16:56:12 Mar  8 2010 (4883)
STEAM Auth Server
Server IP address 127.0.1.1:27030

   Metamod version 1.19  Copyright (c) 2001-2006 Will Day <willday@metamod.org>
   Metamod comes with ABSOLUTELY NO WARRANTY; for details type `meta gpl'.
   This is free software, and you are welcome to redistribute it
   under certain conditions; type `meta gpl' for details.

./hlds_run: line 321: 27832 Violación de segmento  $HL_CMD

.. If I run the script again and again the server will start completly any moment


Thanks
edit: In the last test, script started one script, the second one gave this crash.
Reply
#5
Code:
#!/bin/bash
#  Copyright (c)2010-2010
#  Ulrich Block
#                                                                  
#  Kontakt:
#  ulblock at gmx.de    
#  www.ulrich-block.de  
#
#

function init {

DIR="/home/USER/prueba1"
DEAMON="hlds_run"
PARAMS="-game cstrike -ip IPP -port 27015 -pingboost 3"
PARAMS2="+maxplayers 14 +map de_dust2 +sys_ticrate 1010 +fps_max 0 +exec cfg/server0.cfg"
NAME="server0"

if [ "`whoami`" = "root" ]; then
echo "Dont run the script as root!"
exit 0
fi

}

function start_server {

if [[ `screen -ls | grep $NAME` ]]; then
echo "Server: $NAME, is already running."
else
echo "Starting $NAME"
cd $DIR
`chrt -r 98 screen -dmS $NAME ./$DEAMON $PARAMS $PARAMS2`;
fi
}

function stop_server {

if [[ `screen -ls | grep $NAME` ]]; then
echo -n "Stopping $NAME"
kill `screen -ls | grep $NAME | awk -F . '{print $1}'| awk '{print $1}'`
echo " ... done."
else
echo "Server: $NAME isnt already running."
fi
}


function wrong_input {
echo "Usage: $0 {start|stop|restart|console}"
exit 1
}

function get_screen {
screen -r $NAME
}

init

case "$1" in
start)
start_server
;;

stop)
stop_server
;;

restart)
stop_server
start_server
;;

console)
get_screen
;;

*)
wrong_input
;;

esac

exit 0

My problem went away.. I edited "liblist.gam" and remove metamod dll..

thanks BehaartesEtwas & TerrorKakarote.. Im using ur script Smile (terror)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)