473,412 Members | 2,075 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Python program as daemon?

Is it possible to run a Python program as daemon?
Thanks
Jul 25 '08 #1
6 3976
Johny <py****@hope.cz>:
Is it possible to run a Python program as daemon?
You can write daemons in basically any language out there.

--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
Jul 25 '08 #2
Johny wrote:
Is it possible to run a Python program as daemon?
Sure -- see http://code.activestate.com/recipes/66012/ for an example
(and some useful stuff in the comments.)
Jul 25 '08 #3
On Jul 25, 8:37*pm, Johny <pyt...@hope.czwrote:
Is it possible to run a Python program as daemon?
Thanks
Here is an example on how to run a Python script as a Unix daemon:

http://svn.plone.org/svn/collective/...emon/daemon.py

Basically it forks twice and redirects open file descriptors to /dev/
null.

On Windows, 'daemons' are called services. You can write Windows
services in Python using the Pywin32 extension. See Mark Hammond's
book for an explanation.

Jul 25 '08 #4
In message
<13**********************************@x35g2000hsb. googlegroups.com>,
sturlamolden wrote:
Basically it forks twice ...
What's the advantage of forking twice over forking once and calling setsid?
Jul 28 '08 #5
Lawrence D'Oliveiro schrieb:
In message
<13**********************************@x35g2000hsb. googlegroups.com>,
sturlamolden wrote:
>Basically it forks twice ...

What's the advantage of forking twice over forking once and calling setsid?
http://code.activestate.com/recipes/278731/

See the comments.

Diez
Jul 28 '08 #6
On 25 Jul, 20:05, sturlamolden <sturlamol...@yahoo.nowrote:
On Jul 25, 8:37 pm, Johny <pyt...@hope.czwrote:
Is it possible to run a Python program as daemon?
Thanks

Here is an example on how to run a Python script as a Unix daemon:

http://svn.plone.org/svn/collective/...a/daemon/daemo...

Basically it forks twice and redirects open file descriptors to /dev/
null.

On Windows, 'daemons' are called services. You can write Windows
services in Python using the Pywin32 extension. See Mark Hammond's
book for an explanation.
Also, on Windows, you can get good results using srvany

http://support.microsoft.com/kb/137890

I've set this up to run Pyhton for a couple of scripts.

Jul 28 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bob Swerdlow | last post by:
I've created a Python daemon that starts a bunch of BitTorrent downloader process. Everything is working fine when I start the daemon by hand (logged on as root). I can quit the session and see...
6
by: Nils Emil P. Larsen | last post by:
Hello I'm building a daemon in Python. It will measure and control some physical devices on a serial bus. Since it is a daemon, it will never terminate and I can't interfere with the regulation...
0
by: Jon Monteleone | last post by:
Greetings, I posted a few days back and didnt get much of a response, so I figured I would post again with more detail. I am running gnome under fedora core 4. I want a kid to be able to drop a...
8
by: Bernard Lebel | last post by:
Hello, I would like to know if there is a way to run a Python file under a different user account than the one logged in. Allow me to explain. There are a bunch of people here, they are "basic...
16
by: diffuser78 | last post by:
I want to write a python program and call OS specific commands in it. So basically, instead of typing in on the command line argument I want to have it in a python program and let it do the action....
3
by: Thomas Dybdahl Ahle | last post by:
Hi, I'm writing a program, using popen4(gnuchess), The problem is, that gnuchess keeps running after program exit. I know about the atexit module, but in java, you could make a process a daemon...
3
by: Mike Orr | last post by:
I'm trying to install a program that uses Durus on a server. It appears that if a Python program uses eggs, it creates a ~/.python-eggs/ directory, so the home directory must be writeable. This...
10
by: NinjaZombie | last post by:
Hi! I was wondering if it is possible to turn the current python proccess into a unix daemon, but not doing it like this: python myscript.py & but from code programaticaly. Thanks.
2
by: Michael Palmer | last post by:
On Sep 5, 9:56 pm, Sean Davis <seand...@gmail.comwrote: xmlrpc is the right idea, as it interfaces easily across languages.
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.