weniger ausgaben

This commit is contained in:
Denis Knauf 2010-09-30 16:58:20 +02:00
parent 590ac40933
commit aa55caba36
3 changed files with 11 additions and 13 deletions

16
c.rb
View file

@ -35,18 +35,16 @@ end
$tor = tor = IO.pipe
$tos = tos = IO.pipe
if Process.fork
Process.fork do
$stdin.reopen tor.first
tor.last.close
$stdout.reopen tos.last
tos.first.close
$stderr.puts( {:ts => ts, :proc => 'c', :machine => machine, :source => source}.inspect)
exec 'ssh', machine, 'perl', '-e', File.readall( File.join( libexec, 's.pl')).shdump, source.shdump
else
$stdin.reopen tos.first
tos.last.close
$stdout.reopen tor.last
tor.first.close
$stderr.puts( {:ts => ts, :proc => 'c', :exec => 'reciever', :destination => destination}.inspect)
exec 'perl', File.join( libexec, 'r.pl'), destination
end
$stdin.reopen tos.first
tos.last.close
$stdout.reopen tor.last
tor.first.close
exec 'perl', File.join( libexec, 'r.pl'), destination

6
r.pl
View file

@ -11,7 +11,7 @@ sub ts {
$SIG{CLD} = sub {
wait;
printf STDERR "{ts: \"".ts."\", proc: \"r\", action: \"exit\", code: $?, error: \"child_died\"}\n";
#printf STDERR "{ts: \"".ts."\", proc: \"r\", action: \"exit\", code: $?, error: \"child_died\"}\n";
exit $?;
};
@ -26,7 +26,7 @@ sub readcmd {
chdir $ARGV[0] or die( "{ts: \"".ts."\", proc: \"r\", error: \"cannot_chdir\", exception: \"$!\"}\n");
while( my$data = readcmd) {
(my$cmd, my$length) = unpack( 'nN', $data);
print STDERR "{ts: \"".ts."\", cmd: $cmd, length: $length}\n";
#print STDERR "{ts: \"".ts."\", cmd: $cmd, length: $length}\n";
read STDIN, $data, $length;
if( 1 == $cmd) {
open( F, '>>', $data) or die( "{ts: \"".ts."\", proc: \"r\", error: \"unable_to_open_file\", message: \"Can't open file <$data>.\"}\n");
@ -40,5 +40,5 @@ while( my$data = readcmd) {
die( "{ts: \"".ts."\", proc: \"r\", error: \"unknown_command\", command: $cmd}\n");
}
}
print STDERR "{ts: \"".ts."\", proc: \"r\", exit: 0}\n";
#print STDERR "{ts: \"".ts."\", proc: \"r\", exit: 0}\n";
exit 0;

2
s.pl
View file

@ -31,5 +31,5 @@ while( my$filename = readdir( DH)) {
close F;
}
closedir DH;
print STDERR "{ts: \"".ts."\", proc: \"s\", exit: 0}\n";
#print STDERR "{ts: \"".ts."\", proc: \"s\", exit: 0}\n";
exit( 0);