Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

When i use python-daemon in code, subprocess cannot exec

def main_pro():
     #some code
     cmd="/path/to/alert.py " + ip + " "+ title + " " + content
     handler = subprocess.Popen(args = cmd, shell = True, stdout = subprocess.PIPE)
     #some other code  

 context = daemon.DaemonContext(
    working_directory='/',
    umask=0o002,
    pidfile=lockfile.FileLock('/tmp/Mon.pid'),
)  

 context.signal_map = { 
        signal.SIGCLD:None,   
        signal.SIGTERM:mon_exit,                                                                                                        
    }   

 with context:
        main_pro()

the code that above is cannot exec subprocess, because cmd has log

when i use main_pro direct, subprocess is worked ,just like this:

def main_pro():
     #some code
     cmd="/path/to/alert.py " + ip + " "+ title + " " + content
     handler = subprocess.Popen(args = cmd, shell = True, stdout = subprocess.PIPE)
     #some other code

main_pro()  
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.