Search code examples
pythonsubprocessweb2pyuwsgi

uwsgi web2py daemonize background process


I have web2py application with controller which is starting some background process like below:

def run_backproc():
    subprocess.call('setsid sh dosomething.sh >/dev/null 2>&1 < /dev/null &', shell=True)
    return True

The problem is when web2py is running with uwsgi app server, then the request doesn't return True while process is running and the GET request is finished unsuccessful. Without uwsgi it works right. Any idea what can be a problem? Thanks


Solution

  • Ok, I have solved it. Little bit more googling and I found, that I need add extra parameter into my web2py.ini. So I added line close-on-exec = true and it works :)