Questions tagged [python-daemon]

Library to implement a well-behaved Unix daemon process

This library (website) implements the well-behaved daemon specification of PEP 3143, "Standard daemon process library".

142 questions
83
votes
5 answers

Python daemon and systemd service

I have a simple Python script working as a daemon. I am trying to create systemd script to be able to start this script during startup. Current systemd…
pawelbial
  • 997
  • 1
  • 10
  • 15
44
votes
3 answers

Daemon vs Upstart for python script

I have written a module in Python and want it to run continuously once started and need to stop it when I need to update other modules. I will likely be using monit to restart it, if module has crashed or is otherwise not running. I was going…
maaz
  • 4,371
  • 2
  • 30
  • 48
40
votes
7 answers

How do I set up a daemon with python-daemon?

I'm new to daemons so apologies if this is a newbie question. In several other answers (for example, this question) people suggested the python-daemon package was the way to go because it fully implements the PEP 3143 standard. Unfortunately,…
CQP
  • 937
  • 2
  • 11
  • 17
25
votes
3 answers

What is the de facto library for creating Python Daemons

I am attempting to use the python-daemon library which seemed to me to be the safest way to create a Daemon without forgetting anything. The documentation is quite poor, being just PEP 3143. On the other hand, I have found a lot of links to Sander…
Marcus Whybrow
  • 19,578
  • 9
  • 70
  • 90
16
votes
3 answers

Can I have some code constantly run inside Django like a daemon

I'm using mod_wsgi to serve a django site through Apache. I also have some Python code that runs as a background process (dameon?). It keeps polling a server and inserts data into one of the Django models. This works fine but can I have this code be…
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
13
votes
2 answers

Run Python HTTPServer in Background and Continue Script Execution

I am trying to figure out how to run my overloaded customized BaseHTTPServer instance in the background after running the "".serve_forever() method. Normally when you run the method execution will hang until you execute a keyboard interrupt, but I…
12
votes
3 answers

Creating Python daemon - 'module' object has no attribute 'DaemonContext'

I'm trying to daemonize my app and am getting the error: out: with daemon.DaemonContext(): out: AttributeError: 'module' object has no attribute 'DaemonContext' It looks like other people are getting this error from the module not being…
Ben McCann
  • 18,548
  • 25
  • 83
  • 101
11
votes
1 answer

Signal handling in python-daemon

I installed python-daemon and now I'm trying to get the signal handling right. My code: #!/usr/bin/env python # -*- coding: utf-8 -*- import signal, time, syslog import daemon def runDaemon(): context = daemon.DaemonContext() …
Ocaso Protal
  • 19,362
  • 8
  • 76
  • 83
8
votes
1 answer

How to package a Python daemon with setuptools

How do you package a Python app with setuptools so that when it's installed (e.g. via setup.py or pip), it places a daemon script in the appropriate location, starts it, and marks it to automatically start at boot time? In my case, my code only…
Cerin
  • 60,957
  • 96
  • 316
  • 522
8
votes
2 answers

How do you use python-daemon the way that it's documentation dictates?

I'm trying to make a daemon in python and I've come across the python-daemon package. The interesting thing about it is that the most common way I've seen it used isn't even what the documentation, which is very sparse, tells you to do import…
m0meni
  • 16,006
  • 16
  • 82
  • 141
8
votes
1 answer

Creating python 2.7 daemon with pep-3143

Does anyone knows how to implement python 2.7 as a Linux daemon? I'm looking for a working example with start/stop arguments.
user1632928
  • 252
  • 1
  • 4
  • 14
7
votes
1 answer

Python Threading: Multiple While True loops

Do you guys have any recommendations on what python modules to use for the following application: I would like to create a daemon which runs 2 threads, both with while True: loops. Any examples would be greatly appreciated! Thanks in…
dobbs
  • 1,089
  • 6
  • 22
  • 45
7
votes
2 answers

Python 3.3.4: python-daemon-3K ; How to use runner

Struggling to try and get a python daemon to work using Python 3.3.4. Im using the latest version of the python-daemon-3K from PyPi i.e. 1.5.8 Starting point is the following code found How do you create a daemon in Python? code i believe is 2.x…
user1837990
  • 201
  • 4
  • 7
6
votes
2 answers

python-daemon context fails to start when a stale PID file is present

I'm using python-daemon, and having the problem that when I kill -9 a process, it leaves a pidfile behind (ok) and the next time I run my program it doesn't work unless I have already removed the pidfile by hand (not ok). I catch all exceptions in…
kdt
  • 27,905
  • 33
  • 92
  • 139
6
votes
1 answer

Python3 create Daemon

I tried to create a Daemon in Python to run on an Ubuntu Server. The code below is the code I have problem with. import sys import time import threading import logging import logging.handlers from daemon import runner class Main(object): def…
Emil Rowland
  • 538
  • 5
  • 25
1
2 3
9 10