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. 10 1576
NinjaZombie <ni*********@net.hrwrites:
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.
Yeah, os.fork and the parent process exits.
Paul Rubin wrote:
NinjaZombie <ni*********@net.hrwrites:
>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.
Yeah, os.fork and the parent process exits.
Or little helpers like twistd -- only feasible if you use Twisted
though.
Regards,
Björn
--
BOFH excuse #438:
sticky bit has come loose
Na dan Sun, 24 Sep 2006 23:19:12 +0200, Bjoern Schliessmann je napisao:
Paul Rubin wrote:
>NinjaZombie <ni*********@net.hrwrites:
>>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.
>Yeah, os.fork and the parent process exits.
Or little helpers like twistd -- only feasible if you use Twisted
though.
Thanks guys, but I'm a little new to this. Take a look at this very simple
code:
import os
print "Entering program"
os.fork()
while (1):
pass # some other work
I was expexting that after 'os.fork()', the rest of the program would run
in the background, which it isn't.
NinjaZombie <ni*********@net.hrwrites:
Thanks guys, but I'm a little new to this. Take a look at this very simple
code:
import os
print "Entering program"
os.fork()
while (1):
pass # some other work
Try it this way:
import os, sys
print "Entering program"
if os.fork():
sys.exit() # parent process exits so shell returns
while (1): # child process continues
pass # some other work
Na dan Sun, 24 Sep 2006 14:35:31 -0700, Paul Rubin je napisao:
Try it this way:
import os, sys
print "Entering program"
if os.fork():
sys.exit() # parent process exits so shell returns
while (1): # child process continues
pass # some other work
This works! Thanks a bunch, Paul.
NinjaZombie schrieb:
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.
There is a good daemonization recipe on activstate: http://aspn.activestate.com/ASPN/Coo...n/Recipe/66012
Diez
Hi,
what is the main difference of running a python program as a daemon or
as a cronjob?
I have written a program at work that checks all internet connections of
our failover sites and saves the results in a MySQL-database.
The whole program is made with django (a webframework) so I had to be
sure that the "checking procedure" is done every 30 minutes.
I used a cronjob for that job, but I don't know if a daemon would be
better...
NinjaZombie wrote:
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.
--
homepage: http://www.the-grudge.net
ICQ: 9450091
Skype: thegrudge_2
Mozilla Thunderbird 1.5.0.5
Arch Linux
Paul Rubin wrote:
"Diez B. Roggisch" <de***@nospam.web.dewrites:
>There is a good daemonization recipe on activstate: http://aspn.activestate.com/ASPN/Coo...n/Recipe/66012
That is worth reading, including the long comment thread.
Yeah, it is somewhat disappointing that the version in the comments is not
the one upfront. I should have already mentioned that, thanks for doing
that.
Diez
Andi Clemens wrote:
Hi,
what is the main difference of running a python program as a daemon or
as a cronjob?
I have written a program at work that checks all internet connections of
our failover sites and saves the results in a MySQL-database.
The whole program is made with django (a webframework) so I had to be
sure that the "checking procedure" is done every 30 minutes.
With a daemon, you might be able to flag up problems earlier than the
periodic check would allow. On the other hand, you *know* that cron
will run every 30 minutes. Do you *know* that your daemon will not
stop running somehow? I suppose I put more trust in cron than I do in
myself.
Regards,
Andy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Emile van Sebille |
last post by:
QOTW: "If we get 2.3.3c1 out in early December, we could release 2.3.3 final
before the end of the year, and start 2004 with a 100% bug-free codebase
<wink>." -- Tim Peters
"cjOr proWe vbCould...
|
by: Emile van Sebille |
last post by:
QOTW: "Have you ever used the copy module? I am *not* a beginner, and have
used it *once* (and I can't remember what for, either)." -- Michael Hudson
"It will likely take a little practice...
|
by: Emile van Sebille |
last post by:
QOTW (in the OS agnostic category): "There is a (very popular) Python
package out there which exposes the win32 api. I'm not sure what it's
called. (win32api? pythonwin? win32all?)" -- Francis...
|
by: jubei |
last post by:
So I'm trying to daemonize a python script , I've got the following already
if os.fork():
sys.exit()
i'm not sure how to handle closing and then reopening stdin,stdout,stderr, or if...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
| |