Skip to content
Snippets Groups Projects
Unverified Commit d6e90938 authored by David Beniamine's avatar David Beniamine
Browse files

small fixes

parent b99ef73f
Branches
No related tags found
No related merge requests found
......@@ -168,13 +168,14 @@ sub do_backup($){
my $name = $CFG::CFG{DISKS}{KNOWN}{$uuid}{name};
my $pid=0;
my $error = 0 ;
$SIG{KILL} = sub { $error=2; if($pid!=0){kill("SIGTERM", $pid);}};
$SIG{KILL} = sub { $error=2;};
$Logger->info("Demarrage de la sauvegarde sur le disque: $name");
# Start each script
for my $scr (keys %{$CFG::CFG{'SCRIPTS'}}){
my $cmd="$CFG::CFG{'scriptdir'}/$scr $CFG::CFG{'SCRIPTS'}{$scr} $disc";
$Logger->info("Lancement du script de sauvegarde '$CFG::CFG{'scriptdir'}/$scr'");
$pid = open SCRLOG, '-|', "$cmd 2>&1";
$SIG{KILL} = sub { $error=2; kill("SIGTERM", $pid);};
# Forward script output
while (my $line = <SCRLOG>){
$Logger->info($line);
......@@ -188,6 +189,7 @@ sub do_backup($){
}
$Logger->info("Script de sauvegarde $scr terminé");
}
$SIG{KILL} = sub { $error=2;};
# Tell main thread that we are done
return end_backup($name, $error);
}
......@@ -242,7 +244,9 @@ sub format_log{
my %args = @_;
my $date = strftime("%F %X", localtime());
my $string = "$date\t$args{level}\t$args{message}\n";
if( not utf8::is_unicode($string)){
utf8::encode($string);
}
return $string;
}
......@@ -358,7 +362,7 @@ sub start_daemon(){
$CFG::CFG{CLIENTS}{$1} = time();
save_config();
notify();
$Logger->debug("Enregistrement de la FIFO client : '$1'");
$Logger->debug("Enregistrement du client : '$1'");
}elsif ($line =~ /^UNREGISTER (.*)$/){
delete $CFG::CFG{CLIENTS}{$1};
save_config();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment