|
|
#1 |
![]() Join Date: Feb 2010
Reputation: 121
Posts: 2,216
|
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" 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 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 Any ideas how to use a script to launch an HLTV? |
|
|
|
|
|
#2 |
|
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. |
|
|
|
|
|
#3 |
![]() Join Date: Feb 2010
Reputation: 121
Posts: 2,216
|
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. |
|
|
|
|
|
#4 |
![]() Join Date: Jan 2003
Reputation: 801
Posts: 4,373
|
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" |
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|