]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
header.pl: only get memory consumption when service is running
authorRobin Roevens <robin.roevens@disroot.org>
Tue, 10 Sep 2024 21:32:32 +0000 (23:32 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 11 Sep 2024 09:45:46 +0000 (09:45 +0000)
It probably doesn't matter much as the get_memory_consumption function just returns 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.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/header.pl

index a90a6f4817675fa00947f0266973b0a721a3d447..3778c4e5995b0c2894c5b723453daa7a9b7ae8f4 100644 (file)
@@ -950,9 +950,6 @@ EOF
                        @pids = &General::find_pids("${process}");
                }
 
-               # Get memory consumption
-               my $mem = &General::get_memory_consumption(@pids);
-
                print <<EOF;
                                <tr>
                                        <th scope="row">
@@ -962,6 +959,9 @@ EOF
 
                # Running?
                if (scalar @pids) {
+                       # Get memory consumption
+                       my $mem = &General::get_memory_consumption(@pids);
+
                        # Format memory
                        $mem = &General::formatBytes($mem);