Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #77819
| 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!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <travisgriggs@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.025 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'output': 0.05; 'subject:Python': 0.06; 'python3': 0.07; 'skip:/ 10': 0.09; 'python': 0.11; "'w')": 0.16; 'file.read()': 0.16; 'statement.': 0.16; 'subject:?)': 0.16; 'subject:Was': 0.16; 'subject:under': 0.16; 'subject:where': 0.16; 'true:': 0.16; 'subject:python': 0.16; 'seems': 0.21; 'command': 0.22; 'import': 0.22; 'to:name :python-list@python.org': 0.22; 'options': 0.25; 'updating': 0.26; 'second': 0.26; 'somewhere': 0.26; 'header:In-Reply-To:1': 0.27; 'work.': 0.31; 'getting': 0.31; 'file:': 0.31; 'file': 0.32; 'there.': 0.32; 'run': 0.32; 'skip:# 10': 0.33; 'updated': 0.34; 'created': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'subject:service': 0.36; 'shows': 0.36; 'thanks': 0.36; 'being': 0.38; 'message- id:@gmail.com': 0.38; 'others.': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'simple': 0.61; 'header:Message-Id:1': 0.63; 'show': 0.63; 'finally': 0.65; 'charset:windows-1252': 0.65; 'anything.': 0.68; 'line,': 0.68; 'default': 0.69; 'special': 0.74; 'doesn\x92t': 0.84; 'can\x92t': 0.91; 'period.': 0.95 |
| 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=HV204enjQgxu4aWPm2uvu3Cs98ccqlMTuaZOv/UB+oo=; b=vQOOrYv8jTGQxpq5hWjicVPiZ3/PqY/yZm8UyquP3wbMi8YRX9ZQl8izS3jAjH8Uyi Ocy2xxhH1BD/cng53SO0iuOAeQIlha0c8Hf7AKTRA+206xtsAhNsylBqMKrj7QXdeF64 TuC0cp+GfYQ7pvg0/WeBjUR8AC62DGdEbgsCq0XcpRSAejB9H513IH+tEbhVsT8NwJwA qzfRu6faYvNATlq4nE4uSfzhWHqkJEi0edJ5hFAXqUpSIRC6+7ZS7zXVRV5TTnZAHMd6 ff77HfgqWh7bpofts8h71jQByPWeB0jg5VO6UkFxV9kXgorQaKsHdy5lP85A8OjUIiOT 0pgA== |
| X-Received | by 10.70.54.193 with SMTP id l1mr12171307pdp.160.1410548749598; Fri, 12 Sep 2014 12:05:49 -0700 (PDT) |
| Content-Type | text/plain; charset=windows-1252 |
| Mime-Version | 1.0 (Mac OS X Mail 7.3 \(1878.6\)) |
| Subject | Python stdout goes where under systemd? (Was: Example of python service running under systemd?) |
| From | Travis Griggs <travisgriggs@gmail.com> |
| In-Reply-To | <CAPTjJmqTYmGy8WHm5a3Vo-A+vXjoXJWf4C0Nr7qXeBuHSEC_AQ@mail.gmail.com> |
| Date | Fri, 12 Sep 2014 12:05:46 -0700 |
| Content-Transfer-Encoding | quoted-printable |
| References | <FE4C3550-8958-4F72-8AFE-62AA7248D6AF@gmail.com> <CAMw+j7+LQL_+77ejCFVSqWap7Rk9gS_Wu5d3y0gT1UpB8hiZAA@mail.gmail.com> <6B97B7A5-0816-401E-9BDD-A23FFC646985@gmail.com> <20140911212921.GB26465@arxnet.hu> <5412548A.1090507@gmail.com> <CAPTjJmq4fYOs-qvko9q9S=M7PNGOLPBTDiPZ6R0PvMrAULC=3g@mail.gmail.com> <20140912061806.GB3333@arxnet.hu> <CAPTjJmqTYmGy8WHm5a3Vo-A+vXjoXJWf4C0Nr7qXeBuHSEC_AQ@mail.gmail.com> |
| To | "python-list@python.org" <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 <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.13981.1410548753.18130.python-list@python.org> (permalink) |
| Lines | 50 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1410548753 news.xs4all.nl 2831 [2001:888:2000:d::a6]:39368 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:77819 |
Show key headers only | View raw
Thanks all for the help/advice. I’m getting there.
To experiment/learn, I made a simple python program (/Foo/cyclic.py):
#!/usr/bin/env python3
import time
while True:
time.sleep(5)
with open('sound', 'r') as file:
currentValue = file.read()
otherValue = 'tick' if currentValue == 'tock' else 'tock'
with open('sound', 'w') as file:
file.write(otherValue)
print(currentValue, '->', otherValue)
Run from the command line, this tick-tocks nicely, both outputting, as well as updating the ‘/Foo/sound’ file on a 5 second period.
I then created a simple .service file:
[Unit]
Description=Foo for learning service
After=network-online.target
[Service]
Type=simple
ExecStart=/Foo/cyclic.py
WorkingDirectory=/Foo
StandardOutput=journal
[Install]
WantedBy=multi-user.target
I chose to be “explicit” with some of the default options (Type and StandardOutput).
I finally executed:
systemctl --system daemon-reload
systemctl enable foo
systemctl start foo
It seems to work. Almost. The file is being updated regularly (watch cat /Foo/sound shows the change happening). But I can’t seem to find the output from my print() statement. journalctl -f doesn’t show anything. Nor does tail -f /var/log/syslog or any of the others. It just seems to be going nowhere? Is there something I need to do special to get the print() output going somewhere logable?
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Python stdout goes where under systemd? (Was: Example of python service running under systemd?) Travis Griggs <travisgriggs@gmail.com> - 2014-09-12 12:05 -0700
csiph-web