daemonize#

From: http://code.activestate.com/recipes/278731-creating-a-daemon-the-python-way/

Disk And Execution MONitor (Daemon)

Configurable daemon behaviors:

1.) The current working directory set to the “/” directory. 2.) The current file creation mode mask set to 0. 3.) Close all open files (1024). 4.) Redirect standard I/O streams to “/dev/null”.

A failed call to fork() now raises an exception.

References

  1. Advanced Programming in the Unix Environment: W. Richard Stevens

  2. Unix Programming Frequently Asked Questions:

    http://www.erlenstar.demon.co.uk/unix/faq_toc.html

who when what —————– ———- ———- Chad J. Schroeder 2008-10-01 Created Alfio Puglisi 2015 Changed WORKDIR and REDIRECT_TO

to be parameters of createDeamon()

Alfio Puglisi 2019-04-15 Converted to Python3

arte.contrib.daemonize.createDaemon(WORKDIR, REDIRECT_TO='/dev/null')#

Detach a process from the controlling terminal and run it in the background as a daemon.