/[Sack]/trunk/bin/lorry.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/lorry.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 95 by dpavlin, Sun Oct 4 12:17:52 2009 UTC revision 102 by dpavlin, Mon Oct 5 20:31:28 2009 UTC
# Line 9  use File::Slurp; Line 9  use File::Slurp;
9  use lib 'lib';  use lib 'lib';
10  use Sack::From;  use Sack::From;
11  use Sack::Lorry;  use Sack::Lorry;
12    use Net::Ping;
13    use Sack::Color;
14    
15  my $view   = 'views/00.demo.pl';  my $view   = 'views/00.demo.pl';
16  my $offset = 0;  my $offset = 0;
17  my $limit  = 5;  my $limit  = 5000;
18  my @cloud  = ( 'localhost', 'localhost' );  my @cloud  = ( 'localhost', 'localhost' );
19    
20    push @cloud, ( '192.168.2.200', '192.168.2.200' ) if `hostname` =~ m{t61p};
21    
22  my $lorry = Sack::Lorry->new;  my $lorry = Sack::Lorry->new;
23    
# Line 25  my $from  = Sack::From->new( Line 28  my $from  = Sack::From->new(
28    
29  my $info;  my $info;
30    
31    my $p = Net::Ping->new;
32    
33  foreach my $host ( @cloud ) {  foreach my $host ( @cloud ) {
34    
35            if ( ! $p->ping( $host ) ) {
36                    warn "SKIP $host - doesn't respond to ping\n";
37                    next;
38            }
39    
40          if ( my $port = $lorry->start_node( $host ) ) {          if ( my $port = $lorry->start_node( $host ) ) {
41    
42                  warn "started [$port] on $host\n";                  warn "started [$port] on $host\n";
# Line 50  warn "info ",dump $info; Line 61  warn "info ",dump $info;
61    
62  warn "load status ", dump( $lorry->get_from_all );  warn "load status ", dump( $lorry->get_from_all );
63    
64  warn "run view $view ", -s $view, " bytes\n";  while ( $view ) {
65  my $view_code = read_file($view);          warn dump( $lorry->view( $view ) );
66  $lorry->send_to_all({ view => $view_code });          print "sack> ";
67  warn "result ", dump( $lorry->get_from_all );          my $cmd = <STDIN>;
68            last unless defined $cmd; # CTRL+D
69            chomp($cmd);
70    }
71    
72  warn "exit all nodes\n";  warn "exit all nodes\n";
73  $lorry->send_to_all( { exit => 1 } );  $lorry->send_to_all( { exit => 1 } );

Legend:
Removed from v.95  
changed lines
  Added in v.102

  ViewVC Help
Powered by ViewVC 1.1.26