I made a daemon with Python, so a memo of the procedure
| environment | version |
|---|---|
| OS | 2020-05-27-raspios-buster-arm64 |
| Python | 3.7.3 |
| python3-systemd | 234-2+b1 |
sudo apt-get install python-systemd python3-systemd~ / foo.py with the following contentsfrom systemd import journal
journal.send('Hello world')
journal.send('Hello, again, world', FIELD2='Greetings!', FIELD3='Guten tag')
journal.send('Binary message', BINARY=b'\xde\xad\xbe\xef')
chmod 755 ~/foo.pysudo nano /etc/systemd/system/foo.service[Unit]
Description = Foo
[Service]
ExecStart = python3 /home/pi/foo.py
Restart = always
Type = simple
[Install]
WantedBy = multi-user.target
sudo systemctl enable foo.servicesudo systemctl start foo.servicesystemctl status roomenv.servicesudo in ʻExecStart`, it will not work (it seems to work with root privileges)Recommended Posts