Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'python3': 0.07; '__name__': 0.09; 'main()': 0.09; 'def': 0.12; 'creates': 0.14; 'thread': 0.14; 'times,': 0.14; "'__main__':": 0.16; 'main():': 0.16; 'packets.': 0.16; 'subject:under': 0.16; 'threads,': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'basically': 0.19; 'import': 0.22; 'looks': 0.24; 'this:': 0.26; 'header:In-Reply- To:1': 0.27; 'chris': 0.29; 'received:172.16': 0.29; 'am,': 0.29; 'reporting': 0.29; 'that.': 0.31; 'layer': 0.31; 'sep': 0.31; 'running': 0.33; 'skip:# 10': 0.33; 'skip:t 40': 0.33; 'board': 0.35; 'received:google.com': 0.35; 'subject:service': 0.36; 'subject:?': 0.36; 'two': 0.37; 'message-id:@gmail.com': 0.38; 'depends': 0.38; 'mine': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:t 30': 0.61; 'address': 0.63; 'header:Message-Id:1': 0.63; 'networking': 0.64; 'charset:windows-1252': 0.65; 'periodically': 0.68; 'serial': 0.72; '2014,': 0.84; 'it\x92s': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=UtZuNZ1THotK9JOe1MM4pPiPIeh8lRQja0C4iWvKQHA=; b=PkOLu0jDJN/hAYHAM3TNLRFT3uNoU+vD+DwxQe4pdoKgXHhSHLsGZijnwHdkcdA89/ AHdfVopCqywQzydZZLKHYSlzqhwVYJLpGnaW8WT/K/Wbl1vL+6UnjqvFiGMtp8nv2MNW TV4JCVj6ykZvK+LkqgxB6PzubJJ+TIIcQg3ao4iOv4r5kKPXWD0lhi6lXfCy+IFR9WYZ C/9u4NgNIngGQFC+UDQUF9EthkQSTVY6bSR75OE2MPBOBn8sZGe68XBqHw0QHXcsM4nY iRRF3I3JZg86W3pamlb/E2pEyDJpYnXl5UP8xj3BL0G3Nwe9QQtmwqf2mi2zyszxCm8/ yHSw== X-Received: by 10.66.183.235 with SMTP id ep11mr4951085pac.113.1410469611563; Thu, 11 Sep 2014 14:06:51 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Example of python service running under systemd? From: Travis Griggs In-Reply-To: Date: Thu, 11 Sep 2014 14:06:48 -0700 Content-Transfer-Encoding: quoted-printable References: To: python-list@python.org X-Mailer: Apple Mail (2.1878.6) 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410469620 news.xs4all.nl 2904 [2001:888:2000:d::a6]:38810 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77778 On Sep 11, 2014, at 11:18 AM, Chris =93Kwpolska=94 Warrick = wrote: > Depends what you want.=20 Mine is not a web service. My main.py looks like this: #!/usr/bin/env python3 import cycle import pushTelemetry from threading import Thread def main(): Thread(target=3DpushTelemetry.udpLoop).start() Thread(target=3Dcycle.cycleLoop).start() if __name__ =3D=3D '__main__': main() It basically creates two threads, one which does some local processing = and control, the other which periodically does reporting via udp = packets. I use the dual threads because they both work with a shared = serial port at times, so I have to synchronize access through that. What I want is to have this startup, after my board has it=92s = networking layer up and running (and hopefully a valid ip address by = then), and to just keep running forever=