Skip to content

Commit 60fdfea

Browse files
authored
Fixed determine/process reboot-cause service dependency (#17406) (sonic-net#132)
Signed-off-by: anamehra <[email protected] sonic-net/sonic-buildimage#16990 for 202405 branch determine-reboot-cause and process-reboot-cause service does not start If the database service fails to restart in the first attempt. Even if the Database service succeeds in the next attempt, these reboot-cause services do not start. The process-reboot-cause service also does not restart if the docker or database service restarts, which leads to an empty reboot-cause history deploy-mg from sonic-mgmt also triggers the docker service restart. The restart of the docker service caused the issue stated in 2 above. The docker restart also triggers determine-reboot-cause to restart which creates an additional reboot-cause file in history and modifies the last reboot-cause. This PR fixes these issues by making both processes start again when dependency meets after dependency failure, making both processes restart when the database service restarts, and preventing duplicate processing of the last reboot reason.m>
1 parent 37c24a9 commit 60fdfea

3 files changed

+10
-10
lines changed

Diff for: data/debian/sonic-host-services-data.determine-reboot-cause.service

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Description=Reboot cause determination service
33
Requires=rc-local.service
44
After=rc-local.service
5+
Wants=process-reboot-cause.service
56

67
[Service]
78
Type=oneshot
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
[Unit]
22
Description=Retrieve the reboot cause from the history files and save them to StateDB
3-
Requires=database.service determine-reboot-cause.service
3+
PartOf=database.service
44
After=database.service determine-reboot-cause.service
55

66
[Service]
77
Type=simple
8+
ExecStartPre=/usr/bin/systemctl is-active database
9+
ExecStartPre=/usr/bin/systemctl is-active determine-reboot-cause
10+
Restart=on-failure
11+
RestartSec=30
12+
RemainAfterExit=yes
813
ExecStart=/usr/local/bin/process-reboot-cause
14+
15+
[Install]
16+
WantedBy=multi-user.target

Diff for: data/debian/sonic-host-services-data.process-reboot-cause.timer

-9
This file was deleted.

0 commit comments

Comments
 (0)