動作しません。私はこのようなPythonスクリプトがあります。Linuxの出力リダイレクトデーモンが
while True:
print("ok")
を私はデーモンtest.service作成します。sudoと
[Unit]
Description=Un service de test.
[Service]
Type=idle
ExecStart=/usr/bin/python3 /home/andy/Desktop/test.py > /home/andy/Desktop/test.log 2>&1
[Install]
WantedBy=multi-user.target
そして私アクティブそれをテストを開始systemctl。サービス。 ログファイルが作成されていません:出力リダイレクトが機能していません。
私はsystemctlステータスtest.serviceを書くとき、私は持っている:私はデーモンスクリプトで出力をリダイレクトする方法
● test.service - Un service de test.
Loaded: loaded (/etc/systemd/system/test.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2017-10-18 00:50:29 CEST; 20s ago
Main PID: 3651 (python3)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/test.service
└─3651 /usr/bin/python3 /home/andy/Desktop/test.py > /home/andy/Desktop/test.log 2>&1
oct. 18 00:50:29 andy-G551JW systemd[1]: Started Un service de test..
oct. 18 00:50:29 andy-G551JW python3[3651]: ok
oct. 18 00:50:29 andy-G551JW python3[3651]: ok
?
[python-daemonとstdout]の可能な複製(https://stackoverflow.com/questions/11146128/python-daemon-and-stdout) – jww