Support alternate log file

tags/0.1.2
Daniel Berteaud 12 years ago
parent 151ff8b893
commit 284605dfb4
  1. 2
      root/usr/bin/samba-db-logd
  2. 12
      root/var/service/samba-db-logd/run

@ -9,7 +9,7 @@ use strict;
our %opts = (); our %opts = ();
# Set default options # Set default options
$opts{log} = '/var/log/smb_audit.log'; $opts{log} = '/var/log/messages';
$opts{debug} = 0; $opts{debug} = 0;
$opts{dbhost} = 'localhost'; $opts{dbhost} = 'localhost';
$opts{dbname} = 'samba_log'; $opts{dbname} = 'samba_log';

@ -7,10 +7,20 @@ my $dbname = $rec->prop('DbName') || 'samba_log';
my $dbuser = $rec->prop('DbUser') || 'samba'; my $dbuser = $rec->prop('DbUser') || 'samba';
my $dbpass = $rec->prop('DbPassword') || 'samba'; my $dbpass = $rec->prop('DbPassword') || 'samba';
my $dbhost = $rec->prop('DbHost') || 'localhost'; my $dbhost = $rec->prop('DbHost') || 'localhost';
my $log = '/var/log/messages';
if (-e '/var/log/smb_audit.log') {
$log = '/var/log/smb_audit.log';
}
elsif ($rec->prop('LogFile')){
$log = $rec->prop('LogFile');
}
open(STDERR, ">&STDOUT"); open(STDERR, ">&STDOUT");
my @args = ("--debug=1", "--dbname=$dbname", "--dbuser=$dbuser", "--dbpass=$dbpass", "--exclude=opendir"); my @args = ("--debug=1", "--dbname=$dbname", "--dbuser=$dbuser",
"--dbpass=$dbpass", "--exclude=opendir",
"--log=$log");
push @args, "--dbhost=$dbhost" if ($dbhost ne 'localhost'); push @args, "--dbhost=$dbhost" if ($dbhost ne 'localhost');

Loading…
Cancel
Save