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".

133 questions
78
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
  • 937
  • 1
  • 9
  • 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
  • 3,991
  • 2
  • 26
  • 47
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
  • 907
  • 2
  • 11
  • 16
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
  • 18,372
  • 7
  • 64
  • 88
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
  • 38,521
  • 65
  • 199
  • 353
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
  • 17,084
  • 8
  • 69
  • 74
10
votes
2 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
  • 16,431
  • 22
  • 74
  • 96
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
  • 50,711
  • 81
  • 269
  • 459
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
  • 4
  • 14
7
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
  • 14,160
  • 14
  • 66
  • 120
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
  • 183
  • 2
  • 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
  • 26,008
  • 26
  • 82
  • 130
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
  • 425
  • 5
  • 19
6
votes
2 answers

running python-daemon as non-priviliged user and keeping group-memberships

I'm writing a daemon in python, using the python-daemon package. the daemon is started at boot-time (init.d) and needs to access various devices. the daemon is to run on an embedded system (beaglebone) running ubuntu. now my problem is that I want…
umläute
  • 23,410
  • 4
  • 50
  • 99
5
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
  • 899
  • 4
  • 17
  • 36
1
2 3
8 9