Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.079 X-Spam-Evidence: '*H*': 0.84; '*S*': 0.00; 'debug': 0.07; 'executable': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'operation,': 0.16; 'subject:under': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'cc:2**0': 0.24; "i've": 0.25; 'script': 0.25; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'michael': 0.29; 'thus': 0.29; 'mode': 0.30; 'strongly': 0.30; 'message-id:@mail.gmail.com': 0.30; 'easier': 0.31; 'sep': 0.31; 'file': 0.32; 'this.': 0.32; 'run': 0.32; 'fri,': 0.33; 'no,': 0.35; 'received:google.com': 0.35; 'instances': 0.36; 'subject:service': 0.36; 'done': 0.36; 'doing': 0.36; 'subject:?': 0.36; 'easily': 0.37; 'handle': 0.38; 'pm,': 0.38; 'little': 0.38; 'url:01': 0.39; '12,': 0.39; 'itself': 0.39; 'read': 0.60; 'you.': 0.62; 'making': 0.63; 'skip:n 10': 0.64; 'url:blogspot': 0.65; 'here': 0.66; 'fact,': 0.69; 'services.': 0.70; 'url:2011': 0.75; 'forks': 0.84; 'to:none': 0.92; 'service:': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=wHMvwsovsr4kvIIyzI/rknNUtsKyyHHG5Jx1YBT4TyY=; b=oMMt2i0rSngOfWDXBmfRhtgZfieGLy8Wz+O+tSWYwRTXwTg8GO+IbI+IzMXzrVkSUi 64KfbdcNYXNThkqJ4bE8mV6ON+C9YEyj8NUOHuGAQXlxwouLQa7i9BQBqYpOwpvMmZEv IH8E/xm8Jxk5vSpnHPC3yqLnjTZ26ZR3xTAeM11Xfpgh1mqtpetgFVZRAwtphtoNGs1N Wml5gBj7RacSz8Xm+Na6CPidyo8HFjAC2juPedQCUmbDkThTQFK2d/NDb0f83PquLvVM 14IAiYMcwxQrG4EaM27ltaZmPwyptCOdvTqvoXTO6PjQJfgAkgltgYgVGqLw7bpnpaKw ABHw== MIME-Version: 1.0 X-Received: by 10.42.24.11 with SMTP id u11mr4897483icb.44.1410488967446; Thu, 11 Sep 2014 19:29:27 -0700 (PDT) In-Reply-To: <5412548A.1090507@gmail.com> References: <6B97B7A5-0816-401E-9BDD-A23FFC646985@gmail.com> <20140911212921.GB26465@arxnet.hu> <5412548A.1090507@gmail.com> Date: Fri, 12 Sep 2014 12:29:27 +1000 Subject: Re: Example of python service running under systemd? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410488971 news.xs4all.nl 2858 [2001:888:2000:d::a6]:39169 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77791 On Fri, Sep 12, 2014 at 12:03 PM, Michael Torrie wrote: > No, you you don't need to do this. Systemd can handle all of that for > you. Read up on the docs on creating systemd services. Here's a little > blog post that has some good examples, both a non-daemonizing service > and a daemonizing service: > > http://patrakov.blogspot.com/2011/01/writing-systemd-service-files.html > > Any executable file can be turned into a daemon service with systemd > (whether or not it forks itself into the background). Thus any python > script can easily be run from systemd. I strongly recommend making a non-daemonizing service. It's so much easier to debug - there's one mode of operation, the script just runs. You can then run that directly in a terminal, or via tmux, or via systemd - and I've done all three with Yosemite. In fact, I think I have instances here on the LAN that are doing all three, right now! ChrisA