Go Back   Steam Users' Forums > Dedicated Server Discussions > Half-Life DS (Linux)

Reply
 
Thread Tools Display Modes
Old 04-13-2012, 06:40 PM   #1
forrestparkay
 
 
 
Join Date: Feb 2010
Reputation: 350
Posts: 4,501
Trying to start HLTV with a script

I am attempting to start an HLTV server with a script.

Normally, if I try to start HLTV, I have to launch screen, and then execute the command

Code:
export LD_LIBRARY_PATH=".:LD_LIBRARY_PATH"
I am trying to do that in a bash script.

If my script reads like this, it launches a screen instance, but of course fails to launch the HLTV server because of the known errors without exporting that library.
Code:
#!/bin/bash

screen -X -S aim quit
sleep 4
cd /home/gamer/hltv/cstrike/aim
/usr/bin/screen -dmS aim ./hltv +exec hltv_aim.cfg -port 27021
The minute I add the export, it no longer launches the screen.

Code:
#!/bin/bash

screen -X -S aim quit
sleep 4
cd /home/gamer/hltv/cstrike/aim
/usr/bin/screen -dmS aim export LD_LIBRARY_PATH=".:LD_LIBRARY_PATH" && ./hltv +exec hltv_aim.cfg -port 27021
Instead, it ignores the screen command, ignores the export command, and instead attempts to launch the hltv in the current window. (Which of course fails.)

Any ideas how to use a script to launch an HLTV?
forrestparkay is online now  
Reply With Quote
Old 04-18-2012, 11:30 AM   #2
iamandrus
 
 
 
Join Date: Nov 2011
Reputation: 0
Posts: 5
First off, you don't have to launch screen with /usr/bin/screen. Just use "screen."

Secondly, screen is including the export in the -dmS parameter, which is invalid. That's why it's failing.
iamandrus is offline   Reply With Quote
Old 04-18-2012, 02:22 PM   #3
forrestparkay
 
 
 
Join Date: Feb 2010
Reputation: 350
Posts: 4,501
First off, I know it's not required, but there is no harm in being absolute.

Secondly you are wrong, I am using plenty of other bash scripts with the -dmS parameter (which starts a screen named "aim" in detached mode), and they work just fine.

Last edited by forrestparkay: 04-18-2012 at 02:24 PM.
forrestparkay is online now   Reply With Quote
Old 04-18-2012, 03:48 PM   #4
pizzahut
 
 
 
Join Date: Jan 2003
Reputation: 1152
Posts: 4,722
Could be a precedence issue. The parser probably reads it as

( /usr/bin/screen -dmS aim export LD_LIBRARY_PATH=".:LD_LIBRARY_PATH" ) && ( ./hltv +exec hltv_aim.cfg -port 27021 )

when it should be

/usr/bin/screen -dmS aim ( export LD_LIBRARY_PATH=".:LD_LIBRARY_PATH" && ./hltv +exec hltv_aim.cfg -port 27021 )

Please take this symbolic, using actual parentheses may or may not work, as the contents are executed in a sub shell.

What I have done is creating an extra script that basically contains the export and the hltv commands, and added this script to the screen command line.

/usr/bin/screen -dmS aim ~/my_scripts/hltv_script.sh

Perhaps it would also work to add the export command prior to executing screen, but I have a feeling that it won't.

Btw, you forgot a '$'. It doesn't matter though because the hltv only needs the dot as path anyway.

export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
pizzahut is offline   Reply With Quote
Reply

Go Back   Steam Users' Forums > Dedicated Server Discussions > Half-Life DS (Linux)


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -7. The time now is 04:03 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2014, All Rights Reserved.