Index: cs.py =================================================================== diff -u -r34a18ebe349364c4e0462d876d4d191bf3df8939 -r8526ff48b8707a6ee883e3931dcbca0630ff3e15 --- cs.py (.../cs.py) (revision 34a18ebe349364c4e0462d876d4d191bf3df8939) +++ cs.py (.../cs.py) (revision 8526ff48b8707a6ee883e3931dcbca0630ff3e15) @@ -30,29 +30,17 @@ if cs_proc: print("CloudSync app already running") else: - print(f"Starting CloudSync app with logging level {logging_level}") + print("Starting CloudSync app with logging level {0}".format(logging_level)) + time.sleep(DELAY) Popen(['python3', 'cloud_sync.py', str(logging_level)]) - # Keep the main process running - while True: - # Check if the subprocess is still running or perform other periodic checks - time.sleep(60) # Adjust the sleep time as needed def stop(): cs_proc_pid = get_pid() if cs_proc_pid: print("Stopping CloudSync app...") time.sleep(DELAY) - try: - os.kill(int(cs_proc_pid), signal.SIGKILL) - print(f"Successfully killed process {cs_proc_pid}") - except PermissionError: - print( - f"Permission denied when trying to kill process {cs_proc_pid}") - except ProcessLookupError: - print(f"No process with PID {cs_proc_pid}") - except Exception as e: - print(f"Error killing process {cs_proc_pid}: {str(e)}") + os.kill(int(cs_proc_pid), signal.SIGKILL) else: print("CloudSync app is not running.")