Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35444

Making a Unix daemon process (was: Forking into the background (Linux))

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'pypi': 0.07; 'pypy': 0.07; 'python': 0.09; 'fork': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'stdout': 0.09; 'subject:into': 0.09; 'subject:process': 0.09; 'index': 0.13; 'yet.': 0.13; '(note': 0.16; 'background,': 0.16; 'finney': 0.16; 'for,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'setsid': 0.16; 'url:debian': 0.16; 'wrote:': 0.17; 'appears': 0.18; 'module': 0.19; 'discussion': 0.20; 'defined': 0.22; "haven't": 0.23; 'script': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'writes:': 0.29; 'url:mailman': 0.29; '(and': 0.32; 'url:python': 0.32; 'url:listinfo': 0.32; 'asked': 0.33; 'to:addr :python-list': 0.33; 'ben': 0.35; 'path': 0.35; 'something': 0.35; 'received:org': 0.36; 'url:org': 0.36; 'closing': 0.36; 'subject: (': 0.36; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'url:lists': 0.65; 'skip:\xe2 10': 0.66; '8bit%:21': 0.69; 'url:a': 0.72; 'goal': 0.74; 'belief': 0.84; 'subject:Making': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Making a Unix daemon process (was: Forking into the background (Linux))
Date Mon, 24 Dec 2012 18:17:56 +1100
References <kb88sk$1lq$1@speranza.aioe.org> <50d7b654$0$6941$e4fe514c@news2.news.xs4all.nl>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host rasputin.madmonks.org
X-Public-Key-ID 0xBD41714B
X-Public-Key-Fingerprint 9CFE 12B0 791A 4267 887F 520C B7AC 2E51 BD41 714B
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-gpg.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
Cancel-Lock sha1:ZB0lKSAK6lUJK3DdZ8q7YRDn74Q=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1243.1356333490.29569.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1356333490 news.xs4all.nl 6881 [2001:888:2000:d::a6]:43472
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35444

Show key headers only | View raw


Hans Mulder <hansmu@xs4all.nl> writes:

> On 24/12/12 01:50:24, Olive wrote:
> > My goal is to write a script that 1) write something to stdout; then
> > fork into the background, closing the stdout (and stderr, stdin) pipe.
> > 
> > I have found this answer (forking -> setsid -> forking)
> > http://stackoverflow.com/a/3356154

You're following a path that leads to the desire for a “daemon”
<URL:http://stackoverflow.com/questions/473620/how-do-you-create-a-daemon-in-python/688448#688448>.

> You may want to look at the python-daemon module on Pypy, which
> appears to do what you need, including some features you haven't asked
> for, yet.

It's even better when you look at it on PyPI
<URL:http://pypi.python.org/pypi/python-daemon/> (note that PyPy is a
Python implementation, PyPI is an index of Python packages).

The discussion forum for ‘python-daemon’ development is at
<URL:http://lists.alioth.debian.org/mailman/listinfo/python-daemon-devel>.

-- 
 \         “Faith may be defined briefly as an illogical belief in the |
  `\                  occurrence of the improbable.” —Henry L. Mencken |
_o__)                                                                  |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Forking into the background (Linux) Olive <not0read0765@yopmail.com> - 2012-12-24 01:50 +0100
  Re: Forking into the background (Linux) Hans Mulder <hansmu@xs4all.nl> - 2012-12-24 02:56 +0100
    Making a Unix daemon process (was: Forking into the background (Linux)) Ben Finney <ben+python@benfinney.id.au> - 2012-12-24 18:17 +1100

csiph-web