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
This commit is contained in:
stan committed 2006-01-12 15:34:12 +00:00
1 parent 90d8f5f3ef
commit 954922707f
1 file changed
+13 -5
+13 -5
View File
@@ -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 );