From 954922707fea35cc5fca4cd2db69a07cb8848c36 Mon Sep 17 00:00:00 2001 From: stan Date: Thu, 12 Jan 2006 15:34:12 +0000 Subject: [PATCH] Bug 247 - Furhter tweaks to make it possibel to run in background or interactively. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1787 e3e1d417-86f3-4887-817a-d78f3d33393f --- scripts/zmaudit.pl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/zmaudit.pl b/scripts/zmaudit.pl index c82ca03ea..feaea3a1d 100644 --- a/scripts/zmaudit.pl +++ b/scripts/zmaudit.pl @@ -68,6 +68,7 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; my $report = 0; my $interactive = 0; +my $has_term = 0; sub usage { @@ -83,7 +84,7 @@ Parameters are :- sub aud_print { my $string = shift; - if ( $report || $interactive ) + if ( $has_term ) { print( $string ); } @@ -120,7 +121,14 @@ sub confirm } else { - Info( "$action\n" ); + if ( $has_term ) + { + print( ", $action\n" ); + } + else + { + Info( $action ); + } $yesno = 1; } return( $yesno ); @@ -139,7 +147,7 @@ if ( $report && $interactive ) usage(); } -my $once = ($report || $interactive || -t STDOUT); +$has_term = ($report || $interactive || -t STDOUT); my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, ZM_DB_PASS ); @@ -316,5 +324,5 @@ do unlink( split( ";", $untainted_old_files ) ); } - sleep( ZM_AUDIT_CHECK_INTERVAL ) if ( !$once ); -} while( !$once ); + sleep( ZM_AUDIT_CHECK_INTERVAL ) if ( !$has_term ); +} while( !$has_term );