2 # This file is part of GNUnet
3 # (C) 2008, 2009 Christian Grothoff (and other contributing authors)
5 # GNUnet is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published
7 # by the Free Software Foundation; either version 3, or (at your
8 # option) any later version.
10 # GNUnet is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with GNUnet; see the file COPYING. If not, write to the
17 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 # Boston, MA 02111-1307, USA.
22 # @file contrib/peerStartHelper.pl
23 # @brief Helper process for starting gnunet-testing peers.
24 # @author Nathan Evans
26 # Finds configuration files (or any files) of the format
27 # /path/*/gnunet-testing-config* and runs gnunet-arm with
28 # each as the given configuration.
30 # usage: peerStartHelper.pl /path/to/testing_dir/
34 my $max_outstanding = 300;
36 $ARGV[0] || die "No directory provided for peer information, exiting!\n";
38 my $directory = $ARGV[0];
39 my @config_files = `find $directory -iname gnunet-testing-config*`;
43 foreach my $file (@config_files)
46 #print "Starting GNUnet peer with config file $file\n";
54 exec "gnunet-arm -q -c $file -s" or die;
59 push @child_arr, $pid;
62 if ($outstanding > $max_outstanding)
64 for (my $i = 0; $i < $max_outstanding / 5; $i++)
66 #print "Too many outstanding peers, waiting!\n";
67 waitpid($child_arr[0], 0);
75 print "All $count peers started (waiting for them to finish!\n";
77 while ($outstanding > 0)
79 waitpid($child_arr[0], 0);
82 if ($outstanding % 50 == 0)
84 print "All $count peers started (waiting for $outstanding to finish!\n";
88 while (wait() != -1) {sleep 1}
90 print "All $count peers started!\n";