没有日志文件systemctl

时间:2017-11-05 14:12:59

标签: python logging raspberry-pi3 systemd

在我的raspberry-pi3上使用systemctl我的python脚本没有日志文件:

pi@raspberrypi:~ $ systemctl status fourmizzzing.service 
● fourmizzzing.service - Ma raspberrypi joue à fourmizzz
   Loaded: loaded (/etc/systemd/system/fourmizzzing.service; enabled)
   Active: failed (Result: exit-code) since dim. 2017-11-05 02:36:58 UTC; 10h ago
  Process: 444 ExecStart=/usr/bin/python3 /home/pi/mes-projets/fourmizzz/fourmizzzing.py (code=exited, status=1/FAILURE)
 Main PID: 444 (code=exited, status=1/FAILURE)

即使重启后我的脚本正在运行:

pi@raspberrypi:~ $ sudo systemctl restart fourmizzzing.service
pi@raspberrypi:~ $ systemctl status fourmizzzing.service 
● fourmizzzing.service - Ma raspberrypi joue à fourmizzz
   Loaded: loaded (/etc/systemd/system/fourmizzzing.service; enabled)
   Active: active (running) since dim. 2017-11-05 14:01:53 UTC; 3s ago
 Main PID: 1605 (python3)
   CGroup: /system.slice/fourmizzzing.service
           └─1605 /usr/bin/python3 /home/pi/mes-projets/fourmizzz/fourmizzzin...

journalctl也无效。

然而,当我使用空闲时,代码打印。 我怎么能有systemd的日志文件?

1 个答案:

答案 0 :(得分:0)

我忘记在命令之前添加sudo。 我很困惑,因为程序状态没有sudo打印。