Calling script from daemon

I am trying to call a script from python-daemon but it doesn't work. this is what I am linking, is it correct?

I also want to pass a random argument to this script, currently I have hardcoded it

import daemon
import time
import subprocess
import os

def interval_monitoring():
    print "Inside interval monitoring"
    while True:
        print "its working"
#         os.system(" 5416ce0eac3d94693cf7dbd8") Tried this too but not working
        subprocess.Popen(" 5416ce0eac3d94693cf7dbd8", shell=False)
        print "condition true"

def run():
    print daemon.__file__
    with daemon.DaemonContext():

if __name__ == "__main__":



source to share

1 answer

If you haven't made an

executable and added #!/usr/bin/env python

to the top line, then you need to call it through python and not directly. So your line will look something like this:

subprocess.check_output(["python", "", "5416ce0eac3d94693cf7dbd8"])



All Articles