ステータスにテキストがある場合は、systemdを再起動しますか?

ステータスにテキストがある場合は、systemdを再起動しますか?

特定のステータステキストによってトリガされるシステムサービス[0]を再起動する方法(例:403

[1]について私が理解したことは、Restart=on-failureそれが私の特定の目的には使用できないことを意味します。

root@raspberrypi:~# systemctl status raspotify

lines 1--1...skipping...
● raspotify.service - Raspotify
   Loaded: loaded (/lib/systemd/system/raspotify.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-12-11 14:35:19 CET; 18h ago
  Process: 2531 ExecStartPre=/bin/mkdir -m 0755 -p /var/cache/raspotify (code=exited, status=0/SUCCESS)
  Process: 2532 ExecStartPre=/bin/chown raspotify:raspotify /var/cache/raspotify (code=exited, status=0/SUCCESS)
 Main PID: 2533 (librespot)
    Tasks: 2 (limit: 1635)
   CGroup: /system.slice/raspotify.service
           └─2533 /usr/bin/librespot --name raspotify (raspberrypi) --backend alsa --bitrate 160 --disable-audio-cache --enable-volume-normalisation --linear-volume --initial-volume=100 --username foo --passwo

Dec 11 14:35:19 raspberrypi systemd[1]: Starting Raspotify...
Dec 11 14:35:19 raspberrypi systemd[1]: Started Raspotify.
Dec 11 14:35:19 raspberrypi librespot[2533]: [2020-12-11T13:35:19Z INFO  librespot] librespot (raspotify v0.14.0) 6aac8a6 (2020-07-24). Built on 2020-07-26. Build ID: wPNyqn0m
Dec 11 14:35:29 raspberrypi librespot[2533]: [2020-12-11T13:35:29Z WARN  librespot_core::apresolve] Failed to resolve Access Point: HTTP error
Dec 11 14:35:29 raspberrypi librespot[2533]: [2020-12-11T13:35:29Z WARN  librespot_core::apresolve] Using fallback "ap.spotify.com:443"
Dec 11 14:35:29 raspberrypi librespot[2533]: [2020-12-11T13:35:29Z INFO  librespot_core::session] Connecting to AP "ap.spotify.com:443"
Dec 11 14:35:39 raspberrypi librespot[2533]: [2020-12-11T13:35:39Z ERROR librespot] Could not connect to server: failed to lookup address information: Temporary failure in name resolution

今は手動で

root@raspberrypi:~# systemctl restart raspotify

すべてが正常に戻った

[0]https://github.com/dtcooper/raspotify

[1]https://www.freedesktop.org/software/systemd/man/systemd.service.html#Restart=

ベストアンサー1

おすすめ記事