#!/usr/bin/perl

use DBI;

 $i=1;
 my $dsn = 'dbi:mysql:imareas:localhost:3306';
    my $user = 'usmareas';
    my $pass = 'mibarquito';
    my $dbh = DBI->connect($dsn, $user, $pass)
     or die "Can.t connect to the DB: $DBI::errstr\n";
     #my $sth = $dbh->prepare("select f_creacion, solicitud, expediente, estado, corregido from docs_fallo order by id");
     my $sth = $dbh->prepare("select token from usuarios where instalacion like \'PRO%\'");
     $sth->execute();
    while(@row = $sth->fetchrow_array()) {
       $token=$row[0];
#       print "$token\n";
       print "$i - Enviando a $token\n";
      `perl envia_argv.pl $token`;
       $i++;
	}
     
                                                                                      
