I am looking something like this.
If i have a method in a class, now that i accept 2 command line arguments (start, stop), so when i run python script.py
start, it will start automatically, now after sometime if user enters script.py stop
it should end gracefully, can it be done.
This is what i have tried to do
from multiprocessing import Process, Queue
from time import sleep
import sys
def start(name):
print('hello', name)
print "Sleeping for 60 sec"
# sleep (60)
if __name__ == '__main__':
p = Process(target=start, args=('bob',))
p.start()
Thanks