handling cpu limiting differently, maybe fine
This commit is contained in:
parent
d988a4ffcb
commit
aa9785da5a
@ -35,11 +35,9 @@
|
|||||||
|
|
||||||
/home/gameservers/.steam/debian-installation/steamapps/common/Counter-Strike Source/cstrike/cfg/autoexec.cfg: <br/>
|
/home/gameservers/.steam/debian-installation/steamapps/common/Counter-Strike Source/cstrike/cfg/autoexec.cfg: <br/>
|
||||||
alias loop "exec looptest.cfg; wait 5; loop;"; wait 5; loop; <br/>
|
alias loop "exec looptest.cfg; wait 5; loop;"; wait 5; loop; <br/>
|
||||||
(textmode is no video output) <br/>
|
|
||||||
|
|
||||||
exporting correct SDL_VIDEO_X11_VISUALID value is important before steam login for starting games correctly <br/>
|
exporting correct SDL_VIDEO_X11_VISUALID value is important before steam login for starting games correctly <br/>
|
||||||
<br/> With the virtual desktop related to the VNC/x2go/nomachine client you can log into steam using the normal GUI -> <br/>
|
<br/> With the virtual desktop related to the VNC/x2go/nomachine client you can log into steam using the normal GUI -> <br/>
|
||||||
once logged in steam can run actively for months without requiring restarts
|
|
||||||
|
|
||||||
## bashrc for users
|
## bashrc for users
|
||||||
in the users thats running a session edit the .bashrc file and add the follwing (remember SDL_VIDEO_X11_VISUALID deppends on glxinfo from xterm terminal):
|
in the users thats running a session edit the .bashrc file and add the follwing (remember SDL_VIDEO_X11_VISUALID deppends on glxinfo from xterm terminal):
|
||||||
@ -52,7 +50,7 @@
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
ovh: 0x205, 0x209
|
0x205, 0x209
|
||||||
|
|
||||||
#if running steam native libraries instead of runtime libraries one might require following apt install for making libpipewire work
|
#if running steam native libraries instead of runtime libraries one might require following apt install for making libpipewire work
|
||||||
|
|
||||||
@ -90,3 +88,4 @@ limiting cpu can throttle the download speed as well. if bots cant connect and a
|
|||||||
#pip3 extra
|
#pip3 extra
|
||||||
|
|
||||||
pip3 install watchdog
|
pip3 install watchdog
|
||||||
|
|
||||||
|
@ -164,17 +164,16 @@ def bot_connect(data):
|
|||||||
#use whatever ip you want here to connect with
|
#use whatever ip you want here to connect with
|
||||||
str1 = ""
|
str1 = ""
|
||||||
if "connect to ze" == data:
|
if "connect to ze" == data:
|
||||||
str1 = f"connect {data_ports['server_ip_port_ze']}"
|
str1 = f"connect {data_ports['server_ip_port_ze']};"
|
||||||
elif "connect to ze2" == data:
|
elif "connect to ze2" == data:
|
||||||
str1 = f"connect {data_ports['server_ip_port_ze2']}; wait 15000;"
|
str1 = f"connect {data_ports['server_ip_port_ze2']};" #wait 15000;
|
||||||
writeCfgInput(str1)
|
writeCfgInput(str1)
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
def cpulimit_pid_of_game():
|
def cpulimit_pid_of_game():
|
||||||
# ' > /dev/null' redirects stdout to /dev/null
|
# ' > /dev/null' redirects stdout to /dev/null
|
||||||
# '2>&1' redirects stderr to the same place as stdout
|
# '2>&1' redirects stderr to the same place as stdout
|
||||||
pid = return_user_owned_pid("pidof cstrike_linux64")
|
pid = return_user_owned_pid("pidof cstrike_linux64")
|
||||||
cmd = f"cpulimit --pid={pid} --limit=5 --background > /dev/null 2>&1"
|
cmd = f"cpulimit --pid={pid} --limit=35 --background > /dev/null 2>&1"
|
||||||
subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE).communicate()[0]
|
subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE).communicate()[0]
|
||||||
|
|
||||||
def delete_lock_file():
|
def delete_lock_file():
|
||||||
@ -188,10 +187,7 @@ def my_file_created_function(event_path):
|
|||||||
|
|
||||||
file_size = None
|
file_size = None
|
||||||
while True:
|
while True:
|
||||||
#repeatedly spamming to kill cpu limitting, its bottlenecking the download speed
|
|
||||||
kill_owned_process("pidof cpulimit")
|
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
stdout, stderr = subprocess.Popen(["ls", "-l", event_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
|
stdout, stderr = subprocess.Popen(["ls", "-l", event_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
|
||||||
#print('stdout: ', stdout)
|
#print('stdout: ', stdout)
|
||||||
#print('stderr: ', stderr)
|
#print('stderr: ', stderr)
|
||||||
@ -206,6 +202,7 @@ def my_file_created_function(event_path):
|
|||||||
|
|
||||||
#in case the bz2 download is not progressing just delete the file and disconnect.
|
#in case the bz2 download is not progressing just delete the file and disconnect.
|
||||||
cur_file_size = stdout.decode().split("autismbots")[1].strip().split(" ")[0]
|
cur_file_size = stdout.decode().split("autismbots")[1].strip().split(" ")[0]
|
||||||
|
print('cur_file_size: ', cur_file_size, ' stdout decode: ', stdout.decode())
|
||||||
if file_size == cur_file_size:
|
if file_size == cur_file_size:
|
||||||
print("Aborting connection. file download is stuck.")
|
print("Aborting connection. file download is stuck.")
|
||||||
writeCfgInput("disconnect;")
|
writeCfgInput("disconnect;")
|
||||||
@ -265,6 +262,7 @@ if __name__ == '__main__':
|
|||||||
print("launching game...")
|
print("launching game...")
|
||||||
fail_safe -= 1
|
fail_safe -= 1
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
cpulimit_pid_of_game()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
@ -297,14 +295,14 @@ if __name__ == '__main__':
|
|||||||
print('bot kicked server full: ', datetime.datetime.now().time())
|
print('bot kicked server full: ', datetime.datetime.now().time())
|
||||||
elif "autismo connected to ze" == data:
|
elif "autismo connected to ze" == data:
|
||||||
print('Bot connected to ze!')
|
print('Bot connected to ze!')
|
||||||
cpulimit_pid_of_game()
|
#cpulimit_pid_of_game()
|
||||||
is_bot_connected_to_ze2 = False
|
is_bot_connected_to_ze2 = False
|
||||||
overwrite_file_access()
|
overwrite_file_access()
|
||||||
elif "not connected to ze2" == data:
|
elif "not connected to ze2" == data:
|
||||||
is_bot_connected_to_ze2 = False
|
is_bot_connected_to_ze2 = False
|
||||||
elif "autismo connected to ze2" == data:
|
elif "autismo connected to ze2" == data:
|
||||||
print('Bot connected to ze2!')
|
print('Bot connected to ze2!')
|
||||||
cpulimit_pid_of_game()
|
#cpulimit_pid_of_game()
|
||||||
is_bot_connected_to_ze2 = True
|
is_bot_connected_to_ze2 = True
|
||||||
overwrite_file_access()
|
overwrite_file_access()
|
||||||
elif "connect to ze" == data or ("connect to ze2" == data and not is_bot_connected_to_ze2):
|
elif "connect to ze" == data or ("connect to ze2" == data and not is_bot_connected_to_ze2):
|
||||||
@ -315,9 +313,7 @@ if __name__ == '__main__':
|
|||||||
print('exiting after running the game for several hours.')
|
print('exiting after running the game for several hours.')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
#stop cpu limitting, its bottlenecking the connection to the server.
|
print('data: ', data)
|
||||||
kill_owned_process("pidof cpulimit")
|
|
||||||
#print('data: ', data)
|
|
||||||
bot_connect(data)
|
bot_connect(data)
|
||||||
elif "clientmessage:" in data:
|
elif "clientmessage:" in data:
|
||||||
messager_name = data.split("clientmessage:", 1)[1].split(f" {data_ports['magic_secret']}")[0]
|
messager_name = data.split("clientmessage:", 1)[1].split(f" {data_ports['magic_secret']}")[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user