From ca6a69f0e7225ea7cabb9f2065ba5fb73b65f9c7 Mon Sep 17 00:00:00 2001 From: Lijwent Date: Thu, 1 Jun 2023 12:14:29 +0200 Subject: [PATCH] Change sed cmd to not add the line if already present --- prommanager | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prommanager b/prommanager index 769ceff..e28b876 100755 --- a/prommanager +++ b/prommanager @@ -678,8 +678,8 @@ function download_blackbox_exporter() { function config_blackbox_exporter() { if [ $LOG_LEVEL -gt 3 ]; then printf "[DEBUG] Config blackbox_exporter\n"; fi # Set ipv4 as preferred protocol for blackbox_exporter - sed -i '4i\ http:' /etc/prometheus/blackbox.yml - sed -i '5i\ preferred_ip_protocol: "ip4"' /etc/prometheus/blackbox.yml + sed -i '4s/^.*$/ http:/; 4t; 4i http:' /etc/prometheus/blackbox.yml + sed -i '5s/^.*$/ preferred_ip_protocol: "ip4"/; 5t; 5i preferred_ip_protocol: "ip4"' /etc/prometheus/blackbox.yml }