Python stdout goes where under systemd? (Was: Example of python service running under systemd?)

Travis Griggs travisgriggs at
Fri Sep 12 21:05:46 CEST 2014

Thanks all for the help/advice. I’m getting there.

To experiment/learn, I made a simple python program (/Foo/
    #!/usr/bin/env python3

    import time

    while True:
        with open('sound', 'r') as file:
            currentValue =
        otherValue = 'tick' if currentValue == 'tock' else 'tock'
        with open('sound', 'w') as file:
        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:

    Description=Foo for learning service

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?

More information about the Python-list mailing list