Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python daemonize

Tags:

python

daemon

I would like to daemonize a python process, and now want to ask if it is good practice to have a daemon running, like a parent process and call another class which opens 10-30 threads.

I'm planning on writing a monitoring script for group of servers and would like to check every server every 5 mins, that each server is checked exactly 5minutes.

I would like to have it this way ( sort of speak, ps auxf style output ):

|monitor-daemon.py
 \-check-server.py
 \-check-server.py

....

Thank you!

like image 315
abiko Avatar asked Aug 01 '10 20:08

abiko


People also ask

What is Python daemon thread?

The threads which are always going to run in the background that provides supports to main or non-daemon threads, those background executing threads are considered as Daemon Threads. The Daemon Thread does not block the main thread from exiting and continues to run in the background.

What is daemon true in Python?

daemon = True will allow the main program to exit. Apps normally wait till all child threads are finished before completing. But, if you don't use join() that threads can run aline, as zombie process... so that daemon option should be used with join().


1 Answers

Maybe you should use http://pypi.python.org/pypi/python-daemon

like image 76
Tony Veijalainen Avatar answered Oct 31 '22 16:10

Tony Veijalainen