From aae7bb5ac88c50ceaae6e5b1fb6bdffdb91d63dd Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Mon, 20 Jan 2025 16:19:38 +0200 Subject: [PATCH] Fix code readability and scoping --- bandwidth/rotate.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bandwidth/rotate.pl b/bandwidth/rotate.pl index d0322e735..52bf2bfc5 100755 --- a/bandwidth/rotate.pl +++ b/bandwidth/rotate.pl @@ -20,18 +20,22 @@ if (!$config{'firewall_system'}) { } # See if this process is already running -if ($pid = &check_pid_file($pid_file)) { +if (my $pid = &check_pid_file($pid_file)) { print STDERR "rotate.pl process $pid is already running\n"; exit; } -open(PID, ">$pid_file"); -print PID $$,"\n"; -close(PID); +open(my $pid, ">$pid_file"); +print $pid $$,"\n"; +close($pid); +# Get the current time $time_now = time(); @time_now = localtime($time_now); @hours = ( ); +# Pre-process command +&pre_process(); + # Scan the entries in the log file &pre_process(); open(LOG, "<".$bandwidth_log);