AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   HL1 Servers (HLDS) (https://forums.alliedmods.net/forumdisplay.php?f=131)
-   -   HLTV crontab script (https://forums.alliedmods.net/showthread.php?t=182952)

ghostofmybrain 04-15-2012 14:24

HLTV crontab script
 
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?

8088 04-15-2012 15:20

Re: HLTV crontab script
 
In your older thread, alexinno's suggestion looks alright: start the screen, and then send commands to it with -X.

pillepallus 04-15-2012 15:31

Re: HLTV crontab script
 
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

fysiks 04-15-2012 16:24

Re: HLTV crontab script
 
Quote:

Originally Posted by ghostofmybrain (Post 1689803)
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.

ghostofmybrain 04-15-2012 16:50

Re: HLTV crontab script
 
Quote:

Originally Posted by fysiks (Post 1689878)
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.

ghostofmybrain 04-15-2012 16:51

Re: HLTV crontab script
 
Quote:

Originally Posted by 8088 (Post 1689852)
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.

fysiks 04-15-2012 16:53

Re: HLTV crontab script
 
Quote:

Originally Posted by ghostofmybrain (Post 1689897)
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).

ghostofmybrain 04-15-2012 17:50

Re: HLTV crontab script
 
Quote:

Originally Posted by fysiks (Post 1689902)
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. :D My HLTV one has a reminder to enter that command.

ghostofmybrain 04-16-2012 11:00

Re: HLTV crontab script
 
Quote:

Originally Posted by ghostofmybrain (Post 1689897)
Oh wow, I never even thought of that.

Just throw that in at the top of my hltv.cfg file?

8088 04-16-2012 13:41

Re: HLTV crontab script
 
No, you should add it to the script that you start HLTV with: ./hltv


All times are GMT -4. The time now is 11:00.

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