SRCDS Steam group


Launching multiple instances of tf2 from a script
#1
Hi all,

More of a linux newbie question than srcds (sorry) but I wonder if anyone can help please.

I'm trying to write some kind of script to run 3 separate instances of tf2 in 3 different directories. Currently we run 3 servers in the same orangebox folder but would like 1 non-modded, 1 mani and 1 other config.

So if I have: /games/tfserver1/orangebox, /games/tfserver2/orangebox, /games/tfserver3/orangebox

and I put the following in an executable file I get 'no such file or directory' from the cd line, which IS valid when I run the line at the console??

cd /home/games/tfserver1/orangebox
screen -A -m -d -S tf_server1 ./srcds_run -console -game tf -autoupdate +map ctf_2fort +maxplayers 24 +servercfgfile server1.
cfg -port 27015

cd /home/games/tfserver2/orangebox
screen -A -m -d -S tf_server2 ./srcds_run -console -game tf -autoupdate +map ctf_2fort +maxplayers 24 +servercfgfile server2.
cfg -port 27015

The screen command syntax is fine if I run it from within the orangebox directory, but I'd like to launch each one from a script in another directory rather than have to cd to each one and run it.

Any suggestions/help as to why the cd command isn't working please? Or is there a better way of doing it. Unforuntately I'm a linux script/shell/bash n00b Sad
Thanks,
Dezz.
Reply
#2
Would it not be:

Code:
cd /home/<username>/games/tfserverX/orangebox/

?

If the <username> part isn't meant to be there for you, then try the above without it - but keep the trailing /
Reply
#3
Hi!

Just wondering how i can execute the server.sh script from my /home/user/ dir instead of at /srcds_1/orangebox ?

I've tried "screen -A -m -d -S server-a ./srcds_1/orangebox/srcds_run" and that did not work.

I tried the same in my perl script in the first place but gave up not long ago...
Reply
#4
That's the kinda problem I'm having. You can't seem to execute the server from anywhere other than within the orangebox directory. Having multiple servers, I'm trying to automate it rather than needing to run a 'launch' file in each orangebox directory.

Soo as I couldn't execute them from another directory, that's where I tried to create a .sh file or something to cd to each server directory and run the launch, but the cd /home/user/tfserver1/orangebox command throws up the 'no such file or directory' error Sad
Reply
#5
Muppet Wrote:Would it not be:

Code:
cd /home/<username>/games/tfserverX/orangebox/

?

If the <username> part isn't meant to be there for you, then try the above without it - but keep the trailing /

Yep, I've got that in there but it's not working. Sad If I copy and paste the line straight in the console the cd command works fine, so I know the directory and syntax are valid. Tis v frustrating!
Reply
#6
Might be silly... but are you starting your script file with the line #!/bin/bash ?
[Image: sig_spam.JPG]
Reply
#7
blik Wrote:Might be silly... but are you starting your script file with the line #!/bin/bash ?

Thanks for the help Smile

I wasn't, and the filename was just an executable called launchtest rather than launchtest.sh

So, I renamed the file to launchtest.sh added the #!/bin/bash and now when I run it this happens:

root@ds5022:/home/mmgame# ./launchtest.sh
-bash: ./launchtest.sh: /bin/bash^M: bad interpreter: No such file or directory
root@ds5022:/home/mmgame#

This is the contents of launchtest:

#!/bin/bash
cd /home/mmgame/tfserver1/orangebox/
screen -A -m -d -S tfservertest ./srcds_run -console -game tf -autoupdate +map cp_well +maxplayers 24 +servercfgfile server1.cfg -port 27015

the cd /home/mmgame/tfserver1/orangebox/ works fine from the console.

Cheers,
Dezz.
Reply
#8
Ok, the .sh bit shouldnt matter... Definitely go the correct permisions on the file? chmod 755 ?
[Image: sig_spam.JPG]
Reply
#9
blik Wrote:Ok, the .sh bit shouldnt matter... Definitely go the correct permisions on the file? chmod 755 ?

Yep, they are but I appear to have sorted it - yay.

I googled the "bad interpreter: No such file or directory" bit which led me to a post suggesting running 'bash scriptname.sh' which then returns me to the prompt and seems to work perfectly.

Cheers guys for your help Big Grin
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)