def growl_request(application, hosts, password, message, title):
for host in hosts:
request = f"/usr/local/bin/growlnotify --sticky --title '{title}' --application
'{application} ' --host '{host}' --password '{password}' '{message}'"
proc = subprocess.Popen([request], shell=True)
time.sleep(10)
# proc.terminate()
proc.kill()
I am using python to call an application that sends growl notifications. It works. However, the application growlnotify never dies. So eventually, the server crashes as it runs out of memory and processor as every run of growlnotify continues showing up in HTOP. I am experimenting with different attempts to terminate or kill the process after it runs but nothing seems to work. How do I get the subprocess to terminate once it has run? I would preferably like to eliminate the sleep and just get the process to run, complete, and then close. What am I doing wrong here?