From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH] header.pl: only get memory consumption when service is running Date: Tue, 10 Sep 2024 23:32:32 +0200 Message-ID: <20240910213232.1695033-1-robin.roevens@disroot.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0798264988664985570==" List-Id: --===============0798264988664985570== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable It probably doesn't matter much as the get_memory_consumption function just r= eturns 0 when no pids are found. But it shouldn't even try as the mem var is = never used when the service is not running. --- config/cfgroot/header.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index a90a6f481..3778c4e59 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -950,9 +950,6 @@ EOF @pids =3D &General::find_pids("${process}"); } =20 - # Get memory consumption - my $mem =3D &General::get_memory_consumption(@pids); - print < @@ -962,6 +959,9 @@ EOF =20 # Running? if (scalar @pids) { + # Get memory consumption + my $mem =3D &General::get_memory_consumption(@pids); + # Format memory $mem =3D &General::formatBytes($mem); =20 --=20 2.46.0 --===============0798264988664985570==--