Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'reply- to:addr:earthlink.net': 0.09; 'subprocess': 0.09; 'terminate': 0.09; 'starts': 0.15; 'command': 0.19; 'itself.': 0.22; 'manually': 0.22; 'runs': 0.24; 'correct': 0.26; 'looks': 0.28; 'server': 0.29; 'from:addr:earthlink.net': 0.29; 'sends': 0.29; 'parent': 0.31; 'to:addr:python-list': 0.32; 'using': 0.34; 'header:X-Complaints-To:1': 0.34; 'header:User-Agent:1': 0.35; 'running': 0.36; 'rather': 0.36; 'exactly': 0.37; 'issue': 0.37; 'run': 0.37; 'but': 0.38; 'so,': 0.38; 'received:org': 0.38; 'question,': 0.39; 'signal': 0.39; 'to:addr:python.org': 0.39; 'header:Mime-Version:1': 0.39; 'would': 0.40; 'header:Received:5': 0.40; 'here.': 0.68; 'reply-to:no real name:2**0': 0.72; 'header :Reply-To:1': 0.72; 'fear': 0.73; 'daemon?': 0.84; 'restart': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Jeffrey Barish Subject: Restarting a daemon Followup-To: gmane.comp.python.general Date: Tue, 26 Apr 2011 06:13:21 -0600 Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: c-67-172-136-150.hsd1.co.comcast.net User-Agent: KNode/4.4.9 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: jeff_barish@earthlink.net 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: 21 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303820019 news.xs4all.nl 81474 [::ffff:82.94.164.166]:41038 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:4034 Not exactly a Python question, but I thought I would start here. I have a server that runs as a daemon. I can restart the server manually with the command myserver restart This command starts a new myserver which first looks up the pid for the one that is running and sends it a terminate signal. The new one then daemonizes itself. I want the server to be able to restart itself. Will it work to have myserver issue "myserver restart" using os.system? I fear that the new myserver, which will be running in a subshell, will terminate the subshell along with the old myserver when it sends the terminate signal to the old myserver. If so, what is the correct way to restart the daemon? Will it work to run the restart command in a subprocess rather than a subshell or will a subprocess also terminate when its parent terminates? -- Jeffrey Barish