Fix setting atop interval on jammy
Systemd unit definition was significantly changed for
atop on Jammy. Setting need to be passed in /etc/default/atop.
Related-Prod: https://mirantis.jira.com/browse/PRODX-48001
Change-Id: Ifdd44a271e87224a5b6e7b86400e7858baac943b
diff --git a/de/heat-templates/scripts/functions.sh b/de/heat-templates/scripts/functions.sh
index e032fba..2620235 100644
--- a/de/heat-templates/scripts/functions.sh
+++ b/de/heat-templates/scripts/functions.sh
@@ -145,7 +145,13 @@
}
function configure_atop {
- sed -i 's/INTERVAL=600/INTERVAL=60/' /usr/share/atop/atop.daily
+ local atop_config='/etc/default/atop'
+ # Since jammy atop systemd unit doesn't use /usr/share/atop/atop.daily
+ # to launch atop.
+ if [[ ${CODENAME} == "bionic" ]] || [[ ${CODENAME} == "focal" ]]; then
+ atop_config='/usr/share/atop/atop.daily'
+ fi
+ sed -i 's/INTERVAL=600/INTERVAL=60/' ${atop_config}
systemctl restart atop
}