| Home | Trees | Indices | Help |
|
|---|
|
|
Disk And Execution MONitor (Daemon)
Check the first argument to the program.
start: start the daemon stop: stop the daemon restart: stop the daemon if running, then start it again status: display running status run: run but not in daemon mode
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".
Almost none of this is necessary (or advisable) if your daemon is being started by inetd. In that case, stdin, stdout and stderr are all set up for you to refer to the network connection, and the fork()s and session manipulation should not be done (to avoid confusing inetd). Only the chdir() and umask() steps remain as useful.
References:
Based on http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012
| Functions | |||
|
|||
|
|||
|
|||
|
|||
|
|||
| Variables | |
UMASK = 0
|
|
WORKDIR =
|
|
MAXFD = 1024
|
|
REDIRECT_TO =
|
|
| Function Details |
This forks the current process into a daemon. The stdin, stdout, and stderr arguments are file names that will be opened and be used to replace the standard file descriptors in sys.stdin, sys.stdout, and sys.stderr. These arguments are optional and default to /dev/null. Note that stderr is opened unbuffered, so if it shares a file with stdout then interleaved output may not appear in the order you expect. |
Check if the given process is running. Note that this just checks that the pid is in use; since process ids can be reused, this isn't a reliable test. |
Process start/stop/restart/status/run commands. Start/stop/restart allow the process to be used as an init.d service. Run runs the process without daemonizing, e.g., from inittab. |
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Mon Mar 16 15:03:12 2009 | http://epydoc.sourceforge.net |