From d8d7a19c8578943ce7bc2bafd14008dd63f0ad48 Mon Sep 17 00:00:00 2001 From: jenz Date: Tue, 21 Feb 2023 14:21:09 +0100 Subject: [PATCH] updated so maps are deleted less frequently --- AutismBotIngame/python/ingamefollowct.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/AutismBotIngame/python/ingamefollowct.py b/AutismBotIngame/python/ingamefollowct.py index aee81cc6..9b3a1ea9 100644 --- a/AutismBotIngame/python/ingamefollowct.py +++ b/AutismBotIngame/python/ingamefollowct.py @@ -142,7 +142,12 @@ if __name__ == '__main__': buffer_size = 4096 #potentially not large enough? connection_issue_counter = 0; #deleting maps - subprocess.getoutput([f"rm '/home/{whoami}/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/Counter-Strike Source/cstrike/download/maps/'*"]) + maps_folder_size = subprocess.Popen(["du", "-sh", f"/home/{whoami}/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/Counter-Strike Source/cstrike/maps"], stdout=subprocess.PIPE).communicate()[0].decode().split("\t")[0] + #deleting when maps folder larger than 150GB + if maps_folder_size.endswith("G"): + maps_folder_size = float(maps_folder_size[:-1]) + if maps_folder_size > 150.0: + subprocess.getoutput([f"rm '/home/{whoami}/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/Counter-Strike Source/cstrike/download/maps/'*"]) #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_*"])