Raised This Month: $12 Target: $400
 3% 

HLTV crontab script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghostofmybrain
Veteran Member
Join Date: Mar 2010
Old 04-15-2012 , 14:24   HLTV crontab script
Reply With Quote #1

I am attempting to start an HLTV server with a script so I can execute it through crontab should I happen to reboot the machine.

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"
before using the hltv start command. (If I don't, it errors out, which is a common known issue with hltv on linux.)

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?
__________________
Boycott ESEA
My servers
ghostofmybrain is offline
8088
Veteran Member
Join Date: Jan 2008
Old 04-15-2012 , 15:20   Re: HLTV crontab script
Reply With Quote #2

In your older thread, alexinno's suggestion looks alright: start the screen, and then send commands to it with -X.
__________________
steamID converter with OpenSearch browser plugin
8088 is offline
pillepallus
Senior Member
Join Date: Oct 2011
Old 04-15-2012 , 15:31   Re: HLTV crontab script
Reply With Quote #3

maybe

#!/bin/bash export LD_LIBRARY_PATH=/"whever your hlds is located"/hlds_l:$LD_LIBRARY_PATH 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
pillepallus is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-15-2012 , 16:24   Re: HLTV crontab script
Reply With Quote #4

Quote:
Originally Posted by ghostofmybrain View Post
I am attempting to start an HLTV server with a script so I can execute it through crontab should I happen to reboot the machine.

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"
before using the hltv start command. (If I don't, it errors out, which is a common known issue with hltv on linux.)
I never have to do this manually. Just put it in your "hltv" start script. Then, when you execute that script, it also gets executed.
__________________
fysiks is offline
ghostofmybrain
Veteran Member
Join Date: Mar 2010
Old 04-15-2012 , 16:50   Re: HLTV crontab script
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
I never have to do this manually. Just put it in your "hltv" start script. Then, when you execute that script, it also gets executed.
Oh wow, I never even thought of that.
__________________
Boycott ESEA
My servers
ghostofmybrain is offline
ghostofmybrain
Veteran Member
Join Date: Mar 2010
Old 04-15-2012 , 16:51   Re: HLTV crontab script
Reply With Quote #6

Quote:
Originally Posted by 8088 View Post
In your older thread, alexinno's suggestion looks alright: start the screen, and then send commands to it with -X.
Ha, oh yeah, I forgot about that thread. If I can't get it to work like fysiks, I'll try that for my bash script.
__________________
Boycott ESEA
My servers
ghostofmybrain is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-15-2012 , 16:53   Re: HLTV crontab script
Reply With Quote #7

Quote:
Originally Posted by ghostofmybrain View Post
Oh wow, I never even thought of that.
But, this is why I've often forget what I had to do to get it working. So, when I redo my computer and need to do it again, it takes me a while to figure it out (if I don't have a backup of course which is rare).
__________________
fysiks is offline
ghostofmybrain
Veteran Member
Join Date: Mar 2010
Old 04-15-2012 , 17:50   Re: HLTV crontab script
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
But, this is why I've often forget what I had to do to get it working. So, when I redo my computer and need to do it again, it takes me a while to figure it out (if I don't have a backup of course which is rare).
I won't have that problem. I can NEVER EVER remember how to make a server, so I always end up just reading the tutorials I've posted on my site. My HLTV one has a reminder to enter that command.
__________________
Boycott ESEA
My servers
ghostofmybrain is offline
ghostofmybrain
Veteran Member
Join Date: Mar 2010
Old 04-16-2012 , 11:00   Re: HLTV crontab script
Reply With Quote #9

Quote:
Originally Posted by ghostofmybrain View Post
Oh wow, I never even thought of that.
Just throw that in at the top of my hltv.cfg file?
__________________
Boycott ESEA
My servers
ghostofmybrain is offline
8088
Veteran Member
Join Date: Jan 2008
Old 04-16-2012 , 13:41   Re: HLTV crontab script
Reply With Quote #10

No, you should add it to the script that you start HLTV with: ./hltv
__________________
steamID converter with OpenSearch browser plugin
8088 is offline
Reply


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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:46.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode