diff --git a/UnitCsvReceiverSmart.pl b/UnitCsvReceiverSmart.pl index e5f3b66..3984458 100644 --- a/UnitCsvReceiverSmart.pl +++ b/UnitCsvReceiverSmart.pl @@ -57,6 +57,10 @@ while ( my $line = $tail->GetLine() ) { or warn getTimeStamp("log") . " >> $truser not in passwd file.\n"; my ( $filename, $path, $suffix ) = fileparse( $trfile, qr/\.[^.]*/ ); + if ( $path eq "/" ) { + $path = "/home/" . $truser . "/"; + $trfile = "/home/" . $truser . $trfile; + } if ( ( ( uc $suffix ) eq ( uc $ext ) ) and ( $filename =~ m/^(\d\d_\d\d\d\d_|)(DT\d\d\d\d|LOC\d*)$/i ) ) @@ -66,7 +70,7 @@ while ( my $line = $tail->GetLine() ) { if ( !-d "$path/log" ) { make_path "$path/log", - { mode => 0755, owner => $truser, group => $truser } + { mode => 0755, owner => $truser, group => $gid } or warn getTimeStamp("log") . " >> Failed to create path: $path/log"; } @@ -74,7 +78,7 @@ while ( my $line = $tail->GetLine() ) { my $outpath = $path . $unit; if ( !-d "$outpath/SQL" ) { make_path "$outpath/SQL", - { mode => 0755, owner => $truser, group => $truser } + { mode => 0755, owner => $truser, group => $gid } or warn getTimeStamp("log") . " >> Failed to create path: $outpath/SQL"; }