import subprocess import threading import time def resetCfgInputShortWait(): str = "wait 1; getpos; wait 1; exec looptest.cfg;" with open('/home/nonroot/.steam/steam/steamapps/common/Counter-Strike Source/cstrike/cfg/looptest.cfg', 'w') as f: f.write(str) def writeCfgInput(Input): with open('/home/nonroot/.steam/steam/steamapps/common/Counter-Strike Source/cstrike/cfg/looptest.cfg', 'w') as f: f.write(Input) def rejoinze(): threading.Timer(60.0 * 20, rejoinze).start() open('/home/nonroot/.steam/steam/steamapps/common/Counter-Strike Source/cstrike/console.log', 'w').close() writeCfgInput("connect 151.80.230.149:27015; wait 500; exec looptest.cfg;") time.sleep(2) resetCfgInputShortWait() #server_ip_ze = "151.80.230.149:27015" #subprocess.Popen(["steam", "steam://connect/" + server_ip_ze]) if __name__ == '__main__': rejoinze()