I am trying to see if there is a way I can suspend and then resume a process in a python script. I get the process pid using os.getpid() and then i suspend the process using suspend(). Is there a way to resume the process without having to manually type "fg" in a shell?
Here is my code:
#!/usr/bin/env python import time import psutil import os sm_pid = os.getpid() p = psutil.Process(sm_pid) print "Going to suspend" p.suspend() time.sleep(5) p.resume() print "process resumed"