Skip to content

octoprint.daemon#

Generic linux daemon base class

Originally from http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/#c35

Daemon #

A generic daemon class.

Usage: subclass the daemon class and override the run() method.

If you want to log the output to someplace different that stdout and stderr, also override the echo() and error() methods.

get_pid() #

Get the pid from the pidfile.

is_running() #

Check if a process is running under the specified pid.

remove_pidfile() #

Removes the pidfile.

restart() #

Restart the daemon.

run() #

You should override this method when you subclass Daemon.

It will be called after the process has been daemonized by start() or restart().

set_pid(pid) #

Write the pid to the pidfile.

start() #

Start the daemon.

status() #

Prints the daemon status.

stop(check_running=True) #

Stop the daemon.

Back to top