From e754b3b32c591ccbea6abbfc3a6fde1e75ff89ee Mon Sep 17 00:00:00 2001 From: anamehra <54692434+anamehra@users.noreply.github.com> Date: Mon, 11 Dec 2023 13:17:40 -0800 Subject: [PATCH] Fixed determine/process reboot-cause service dependency (#17462) Signed-off-by: anamehra --- ...c-host-services-data.determine-reboot-cause.service | 5 +++-- ...nic-host-services-data.process-reboot-cause.service | 10 +++++++++- ...sonic-host-services-data.process-reboot-cause.timer | 9 --------- 3 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.timer diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.determine-reboot-cause.service b/src/sonic-host-services-data/debian/sonic-host-services-data.determine-reboot-cause.service index e834b9337331..fa9e70773fd2 100644 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.determine-reboot-cause.service +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.determine-reboot-cause.service @@ -1,7 +1,8 @@ [Unit] Description=Reboot cause determination service -Requires=rc-local.service database.service -After=rc-local.service database.service +Requires=rc-local.service +After=rc-local.service +Wants=process-reboot-cause.service [Service] Type=oneshot diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.service b/src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.service index 14af8868e164..f5ba2d119514 100644 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.service +++ b/src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.service @@ -1,8 +1,16 @@ [Unit] Description=Retrieve the reboot cause from the history files and save them to StateDB -Requires=database.service determine-reboot-cause.service +PartOf=database.service After=database.service determine-reboot-cause.service [Service] Type=simple +ExecStartPre=/usr/bin/systemctl is-active database +ExecStartPre=/usr/bin/systemctl is-active determine-reboot-cause +Restart=on-failure +RestartSec=30 +RemainAfterExit=yes ExecStart=/usr/local/bin/process-reboot-cause + +[Install] +WantedBy=multi-user.target diff --git a/src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.timer b/src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.timer deleted file mode 100644 index 222c51a79a03..000000000000 --- a/src/sonic-host-services-data/debian/sonic-host-services-data.process-reboot-cause.timer +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Delays process-reboot-cause until network is stably connected - -[Timer] -OnBootSec=1min 30 sec -Unit=process-reboot-cause.service - -[Install] -WantedBy=timers.target