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: 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 In-Reply-To: Date: Fri, 12 Sep 2014 12:05:46 -0700 Content-Transfer-Encoding: quoted-printable References: <6B97B7A5-0816-401E-9BDD-A23FFC646985@gmail.com> <20140911212921.GB26465@arxnet.hu> <5412548A.1090507@gmail.com> <20140912061806.GB3333@arxnet.hu> 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: 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 Thanks all for the help/advice. I=92m getting there. To experiment/learn, I made a simple python program (/Foo/cyclic.py): =20 #!/usr/bin/env python3 import time while True: time.sleep(5)=09 with open('sound', 'r') as file: currentValue =3D file.read() otherValue =3D 'tick' if currentValue =3D=3D '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 =91/Foo/sound=92 file on a 5 second period. I then created a simple .service file: [Unit] Description=3DFoo for learning service After=3Dnetwork-online.target =20 [Service] Type=3Dsimple ExecStart=3D/Foo/cyclic.py WorkingDirectory=3D/Foo StandardOutput=3Djournal =20 [Install] WantedBy=3Dmulti-user.target I chose to be =93explicit=94 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=92t seem to find the = output from my print() statement. journalctl -f doesn=92t 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?