I set up a service on Raspbian (Jessie) using systemd to make it start after boot. The daemon config looks like this:
[Unit]
After=multi-user.target
[Service]
Type=idle
User=root
ExecStart=/bin/sh -c "exec /home/pi/sources/mydaemon.py >> /home/pi/mydaemon.log 2>&1"
[Install]
WantedBy=multi-user.target
That redirection >>
isn't working. I have tried most of the options available to the StandardOutput
and StandardError
but they never end up printing my script's output to /var/log/daemon.log and journalctl -u mydaemon.service
only shows messages about the service being started and stopped.
I'm not doing anything funny with file descriptors from within the script currently. I just want my print()
or logging.info()
statements to show up somewhere I can read them. Any ideas?
(Just to be clear, the daemon does have to run as root. Could that have something to do with my printing problem?)