Default to auditing all Storage Areas. Add a Server flag to audit only areas on a specific server.
This commit is contained in:
parent
534aebb21f
commit
042d4c3099
|
@ -67,6 +67,7 @@ my $level = 1;
|
||||||
my $monitor_id = 0;
|
my $monitor_id = 0;
|
||||||
my $version;
|
my $version;
|
||||||
my $force = 0;
|
my $force = 0;
|
||||||
|
my $server_id = undef;
|
||||||
my $storage_id = undef;
|
my $storage_id = undef;
|
||||||
|
|
||||||
logInit();
|
logInit();
|
||||||
|
@ -78,6 +79,7 @@ GetOptions(
|
||||||
level =>\$level,
|
level =>\$level,
|
||||||
'monitor_id=i' =>\$monitor_id,
|
'monitor_id=i' =>\$monitor_id,
|
||||||
report =>\$report,
|
report =>\$report,
|
||||||
|
'server_id=i' =>\$server_id,
|
||||||
'storage_id=i' =>\$storage_id,
|
'storage_id=i' =>\$storage_id,
|
||||||
version =>\$version
|
version =>\$version
|
||||||
) or pod2usage(-exitstatus => -1);
|
) or pod2usage(-exitstatus => -1);
|
||||||
|
@ -181,13 +183,15 @@ MAIN: while( $loop ) {
|
||||||
Term();
|
Term();
|
||||||
}
|
}
|
||||||
Info("Auditing Storage Area $Storage_Areas[0]{Id} $Storage_Areas[0]{Name} at $Storage_Areas[0]{Path}");
|
Info("Auditing Storage Area $Storage_Areas[0]{Id} $Storage_Areas[0]{Name} at $Storage_Areas[0]{Path}");
|
||||||
} elsif ( $Config{ZM_SERVER_ID} ) {
|
} elsif ( $server_id ) {
|
||||||
@Storage_Areas = ZoneMinder::Storage->find( ServerId => $Config{ZM_SERVER_ID} );
|
@Storage_Areas = ZoneMinder::Storage->find( ServerId => $server_id );
|
||||||
if ( ! @Storage_Areas ) {
|
if ( ! @Storage_Areas ) {
|
||||||
Error("No Storage Area found with ServerId =" . $Config{ZM_SERVER_ID});
|
Error("No Storage Area found with ServerId =" . $server_id);
|
||||||
Term();
|
Term();
|
||||||
}
|
}
|
||||||
Info("Auditing All Storage Areas on Server " . $Storage_Areas[0]->Server()->Name());
|
foreach my $Storage ( @Storage_Areas ) {
|
||||||
|
Info('Auditing ' . $Storage->Name() . ' at ' . $Storage->Path() . ' on ' . $Storage->Server()->Name() );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
@Storage_Areas = ZoneMinder::Storage->find();
|
@Storage_Areas = ZoneMinder::Storage->find();
|
||||||
Info("Auditing All Storage Areas");
|
Info("Auditing All Storage Areas");
|
||||||
|
@ -382,7 +386,7 @@ MAIN: while( $loop ) {
|
||||||
} # if USE_DEEP_STORAGE
|
} # if USE_DEEP_STORAGE
|
||||||
Debug( 'Got '.int(keys(%$fs_events))." filesystem events for monitor $monitor_dir\n" );
|
Debug( 'Got '.int(keys(%$fs_events))." filesystem events for monitor $monitor_dir\n" );
|
||||||
|
|
||||||
delete_empty_directories($monitor_dir);
|
delete_empty_directories($$Storage{Path}.'/'.$monitor_dir);
|
||||||
} # end foreach monitor
|
} # end foreach monitor
|
||||||
|
|
||||||
if ( $cleaned ) {
|
if ( $cleaned ) {
|
||||||
|
|
Loading…
Reference in New Issue