diff --git a/AutismBotIngame/python/exit_handler.py b/AutismBotIngame/python/exit_handler.py new file mode 100644 index 00000000..255ccef2 --- /dev/null +++ b/AutismBotIngame/python/exit_handler.py @@ -0,0 +1,9 @@ +#!/home/autismbot1/ze_runner/venv/bin/python3 + +if __name__ == '__main__': + import subprocess + #deleting POSIX shared memory objects, as long as one process has them open they exist. THis is to prevent /dev/shm from being full + #due to steam child processes. + #even with steam turned offline might there be chromium web browsers left over from steam who still hold processes open. + #only kind of potential issues from this is steam cloud being out of sync, which is really fucking irrelevant. + subprocess.getoutput([f"pkill -9 -u {whoami}"]) diff --git a/AutismBotIngame/python/ingamefollowct.py b/AutismBotIngame/python/ingamefollowct.py index 2dc07e09..c40e357d 100644 --- a/AutismBotIngame/python/ingamefollowct.py +++ b/AutismBotIngame/python/ingamefollowct.py @@ -35,6 +35,11 @@ def exit_handler(): #securing the looptest.cfg wont be stuck accidently with commands kill_owned_process("pidof hl2_linux") kill_owned_process("pidof xterm") + #deleting POSIX shared memory objects, as long as one process has them open they exist. THis is to prevent /dev/shm from being full + #due to steam child processes. + #even with steam turned offline might there be chromium web browsers left over from steam who still hold processes open. + #only kind of potential issues from this is steam cloud being out of sync, which is really fucking irrelevant. + subprocess.getoutput([f"pkill -9 -u {whoami}"]) def bot_process_movement(input_line): dist_target = input_line[input_line.index("dist_target:") + len("dist_target:"):input_line.index("enemy_distance")] @@ -178,10 +183,6 @@ if __name__ == '__main__': if maps_folder_size > 40.0: for f in glob.glob(f"/home/{whoami}/.steam/debian-installation/steamapps/common/Counter-Strike Source/cstrike/download/maps/*"): subprocess.Popen(["rm", f], stdout=subprocess.PIPE).communicate()[0] - #deleting POSIX shared memory objects, as long as one process has them open they exist. so probably until steam gets turned off. THis is to prevent /dev/shm from being full - #subprocess.getoutput([f"rm /dev/shm/u1001-Shm_*"]) - #subprocess.getoutput([f"rm /dev/shm/u1002-Shm_*"]) - #NOTE since not running vm's anymore i quit doing this. instead just restarting the service every 10 hours. restart_sdl_and_steam() is_bot_connected_to_ze2 = False @@ -233,6 +234,7 @@ if __name__ == '__main__': if connection_issue_counter == 5: kill_owned_process("pidof hl2_linux") print('exiting') + sock.close() sys.exit(1) else: if call_bot_connect: