Fix code readability and scoping

This commit is contained in:
Ilia Ross
2025-01-20 16:19:38 +02:00
parent 67391244e4
commit aae7bb5ac8

View File

@ -20,18 +20,22 @@ if (!$config{'firewall_system'}) {
} }
# See if this process is already running # 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"; print STDERR "rotate.pl process $pid is already running\n";
exit; exit;
} }
open(PID, ">$pid_file"); open(my $pid, ">$pid_file");
print PID $$,"\n"; print $pid $$,"\n";
close(PID); close($pid);
# Get the current time
$time_now = time(); $time_now = time();
@time_now = localtime($time_now); @time_now = localtime($time_now);
@hours = ( ); @hours = ( );
# Pre-process command
&pre_process();
# Scan the entries in the log file # Scan the entries in the log file
&pre_process(); &pre_process();
open(LOG, "<".$bandwidth_log); open(LOG, "<".$bandwidth_log);