systemd はサービスの開始順序を制御します。

systemd はサービスの開始順序を制御します。

2つのシステムサービスファイルがあります。gw_web.serviceそれ以来始めたいですgw_log.service

以下は2つのサービスファイルです。

gw_log.service:

[Unit]
Description=myGarage Log Service
After=multi-user.target

[Service]
Type=idle
User=pi
Restart=always
RestartSec=1
ExecStartPre=-/usr/bin/rm /home/pi/myprojects/myGarage/gw_log.service.log
ExecStart=/usr/bin/python3 -u /home/pi/myprojects/myGarage/gw_log.py
StandardOutput=file:/home/pi/myprojects/myGarage/gw_log.service.log

[Install]
WantedBy=multi-user.target

gw_web.service:

[Unit]
Description=myGarage Web Service
Requires=gw_log.service
After=gw_log.service

[Service]
Type=idle
User=pi
Restart=always
RestartSec=1
ExecStartPre=-/usr/bin/rm /home/pi/myprojects/myGarage/gw_web.service.log
ExecStart=/usr/bin/python3 -u /home/pi/myprojects/myGarage/gw_web.py
StandardOutput=file:/home/pi/myprojects/myGarage/gw_web.service.log

[Install]
WantedBy=multi-user.target

サーバーを再起動すると、サーバーのみがアクティブにgw_log.serviceなります。gw_web.service死んだ。もしそうなら、systemctl start gw_webすべてがうまくいきます。しかし、起動時には動作しません。

このサービスを無効にしてから再度有効にしました。楽しみはありません。私は何が間違っていましたか?

更新:gw_web.service/startとmulti-user.target/startの購読サイクルのため、gw_web.serviceを起動できません。 Unitセクションを追加してDefaultDependencies=noこの問題を解決しました。gw_web.service

ベストアンサー1

おすすめ記事