Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76836
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'insert': 0.05; 'python3': 0.07; 'restart': 0.09; 'restarted': 0.09; 'skip:/ 10': 0.09; 'runs': 0.10; 'abort': 0.16; 'attaching': 0.16; 'charles': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'i\xe2\x80\x99d': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'stderr': 0.16; 'stdout': 0.16; 'subject:between': 0.16; 'travis': 0.16; 'wrote:': 0.18; 'command': 0.22; 'header:User-Agent:1': 0.23; "shouldn't": 0.24; 'cheers,': 0.24; 'file.': 0.24; 'right.': 0.26; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'external': 0.29; 'said,': 0.30; 'bunch': 0.31; 'easy,': 0.31; 'there.': 0.32; 'this.': 0.32; 'stuff': 0.32; 'running': 0.33; 'minimal': 0.33; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'something': 0.35; 'but': 0.35; 'curious': 0.36; 'received:com.au': 0.36; 'skip:> 10': 0.36; 'subject:?': 0.36; 'should': 0.36; 'half': 0.37; 'so,': 0.37; 'received:211': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'then,': 0.60; 'first': 0.61; 'content-disposition:inline': 0.62; 'size.': 0.65; 'managing': 0.66; 'importantly,': 0.68; 'default': 0.69; '(probably': 0.84; 'etc,': 0.84; 'technique': 0.93 |
| Date | Sat, 23 Aug 2014 12:09:59 +1000 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | python-list@python.org |
| Subject | Re: Halfway point between interactive and daemon? |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Disposition | inline |
| Content-Transfer-Encoding | 8bit |
| In-Reply-To | <3DBE5DB0-3FA8-43BB-947C-9F6C265D0699@gmail.com> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| References | <3DBE5DB0-3FA8-43BB-947C-9F6C265D0699@gmail.com> |
| X-Optus-CM-Score | 0 |
| X-Optus-CM-Analysis | v=2.1 cv=BdjhjNd2 c=1 sm=1 tr=0 a=YuQlxtEQCowy2cfE5kc7TA==:117 a=YuQlxtEQCowy2cfE5kc7TA==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=LcaDllckn3IA:10 a=81x5LC9LkJEA:10 a=k2yRor-JockA:10 a=IkcTkHD0fZMA:10 a=vrnE16BAAAAA:8 a=pGLkceISAAAA:8 a=rw4YhiA4AAAA:8 a=Jf3M1j4-1q4EPXxPYTgA:9 a=QEXdDO2ut3YA:10 a=MSl-tDqOz04A:10 a=1l0VppTa114A:10 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13321.1408759809.18130.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1408759809 news.xs4all.nl 2961 [2001:888:2000:d::a6]:51034 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:76836 |
Show key headers only | View raw
On 22Aug2014 12:27, Travis Griggs <travisgriggs@gmail.com> wrote:
>I’m curious if there’s a technique one could use to get half way there.
>Basically, with minimal modifications, I’d like to get it running at startup.
>So I can put a line like this in rc.local
>
>nohup python3 myMain.py 2>&1 > /var/log/mylog.log &
Just to this. You have your redirections backwards. They are applied left to
right. So, first "2>&1": sending stderr to where stdout currently goes
(probably the system console if this runs from rc.local). Then, ">
/var/log/mylog.log": sending current stdout to the log file. Importantly, _not_
attaching stderr to the log file.
You want to write this:
command >log 2>&1
As others have remarked, you do not need to daemonise a process started from
rc.local.
And as others have remarked, if you want it to start/stop under external
conrol, or restart after a program abort etc, you may be better adding it as to
the configuration of something like systemd or init.
That said, I start a bunch of things in rc.local. It is quick and easy, and
also handy for stuff that shouldn't be restarted automatically if it dies.
>Then I can “check” on it when I need to with a tail -f /var/log/mylog.log. But
>then I have the problem of managing the log size. And also I either have to
>wait for stdout to flush, or insert sys.stdout.flush() after any of my
>print()’s.
Log messages should be going to stderr anyway, which by default is unbuffered.
Cheers,
Cameron Simpson <cs@zip.com.au>
You can't have everything... where would you put it?
- Charles Robinson, cr0100@medtronic.com
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Halfway point between interactive and daemon? Cameron Simpson <cs@zip.com.au> - 2014-08-23 12:09 +1000
csiph-web