[BACK]Return to zlist CVS log [TXT][DIR] Up to [local] / wpscripts / zlist

Diff for /wpscripts/zlist/zlist between version 1.1.1.1 and 1.8

version 1.1.1.1, 2011/06/03 09:28:47 version 1.8, 2011/12/21 09:33:05
Line 7 
Line 7 
 $| = 1;  $| = 1;
   
 # database  # database
 our $server = "MSSQL";  our $server = "pdc";
 our $user = "it_men";  our $user = "sa";
 our $pass = "itmen712";  our $pass = "aekghbynflvby";
 our $dsn = "DBI:Sybase:server=$server";  our $dsn = "DBI:Sybase:server=$server";
 our $sth;  our $sth;
   
Line 38 
Line 38 
   
 my $time2 = [gettimeofday];  my $time2 = [gettimeofday];
   
 print GREEN "Время отклика от базы данных: " . tv_interval($time1, $time2) . " секунд\n". RESET;  print GREEN "DB response time: " . tv_interval($time1, $time2) . " seconds\n". RESET;
   
 if( ! -e "/var/run/ztransfer.lock")  if( ! -e "/var/run/ztransfer.lock")
 {  {
         print YELLOW "ztransfer сейчас не запущен\n" . RESET;          print YELLOW "ztransfer is not running\n" . RESET;
 }  }
 else  else
 {  {
         if( -e "/var/log/ztransfer/FILE" && -e "/var/log/ztransfer/ACTION")          if( -e "/var/log/wpscripts/ztransfer/FILE" && -e "/var/log/ztransfer/ACTION")
         {          {
             open(CURRENT, "/var/log/ztransfer/FILE");              open(CURRENT, "/var/log/wpscripts/ztransfer/FILE");
             my $file = <CURRENT>;              my $file = <CURRENT>;
             close(CURRENT);              close(CURRENT);
   
             open(CURRENT, "/var/log/ztransfer/ACTION");              open(CURRENT, "/var/log/wpscripts/ztransfer/ACTION");
             my $action = <CURRENT>;              my $action = <CURRENT>;
             close(CURRENT);              close(CURRENT);
   
   
             print "DEBUG: $file $action\n";              print "DEBUG: $file $action\n";
   
             print YELLOW "ztransfer выполняется [ " . ($action eq 'rar' ? "сжимается " : "копируется ") . "$file ]\n" . RESET;              print YELLOW "ztransfer is running [ " . ($action eq 'rar' ? "compressing " : "copying ") . "$file ]\n" . RESET;
         }          }
         else          else
         {          {
             print YELLOW "ztransfer выполняется\n" . RESET;              print YELLOW "ztransfer is running\n" . RESET;
         }          }
 }  }
   
 # print out zayavki info  # print out zayavki info
 print BOLD WHITE ON_BLUE "Очередь заявок". RESET . " ($#numcard штук) :\n";  print BOLD WHITE ON_BLUE "Zayavki queue". RESET . " ($#numcard pcs.) :\n";
     $i = 0;      $i = 0;
     while( ($numcard[$i]) )      while( ($numcard[$i]) )
     {      {
         print "$numcard[$i]\t[ оформлено $time[$i],  приоритет=$pri[$i],  файл=$path[$i] (размер=$size[$i]), счётчик передач=$tx_count[$i] ]\n";          print "$numcard[$i]\t[ executed $time[$i],  priority=$pri[$i],  file=$path[$i] (size=$size[$i]), transfer counter=$tx_count[$i] ]\n";
         $i++;          $i++;
         $total++;          $total++;
     }      }
 print "\n";  print "\n";
   
   
     # fetch jpegs  # fetch probas
     db_fetch(1);  db_fetch(1);
   
 #    print "****** jpegs ($#numcard) ******\n";  #print "****** probas ($#numcard) ******\n";
     print  BOLD WHITE ON_BLUE "Очередь джепегов". RESET . " ($#numcard штук) :\n";  print BOLD WHITE ON_BLUE "Probas queue". RESET . " ($#numcard pcs.) :\n";
         $i = 0;          $i = 0;
         while( ($numcard[$i]) )          while( ($numcard[$i]) )
         {          {
             print "$numcard[$i]\t[ оформлено $time[$i],  приоритет=$pri[$i],  файл=$path[$i] (размер=$size[$i]) ]\n";              print "$numcard[$i]\t[ executed $time[$i],  priority=$pri[$i],  file=$path[$i] (size=$size[$i]) ]\n";
             $i++;              $i++;
             $total++;              $total++;
         }          }
     print "\n";  print "\n";
   
   # fetch TT
   db_fetch(2);
   
         # fetch probas  print BOLD WHITE ON_BLUE "TT queue". RESET . " ($#numcard pcs.) :\n";
         db_fetch(2);  
   
 #       print "****** probas ($#numcard) ******\n";  
         print BOLD WHITE ON_BLUE "Очередь цветопроб". RESET . " ($#numcard штук) :\n";  
         $i = 0;          $i = 0;
         while( ($numcard[$i]) )          while( ($numcard[$i]) )
         {          {
             print "$numcard[$i]\t[ оформлено $time[$i],  приоритет=$pri[$i],  файл=$path[$i] (размер=$size[$i]) ]\n";                  print "$numcard[$i]\t[ executed $time[$i],  priority=$pri[$i],  file=$path[$i] (size=$size[$i]) ]\n";
             $i++;                  $i++;
             $total++;                  $total++;
         }          }
         print "\n";  print "\n";
   
   # fetch jpeg
   db_fetch(3);
   
   print BOLD WHITE ON_BLUE "jpeg queue". RESET . " ($#numcard pcs.) :\n";
           $i = 0;
           while( ($numcard[$i]) )
           {
                   print "$numcard[$i]\t[ executed $time[$i],  priority=$pri[$i],  file=$path[$i] (size=$size[$i]) ]\n";
                   $i++;
                   $total++;
           }
   print "\n";
   
   
 # print summary information  # print summary information
 print BOLD WHITE . "Всего: " . RESET . "$total файлов в очереди на копирование в Заборье.\n";  print BOLD WHITE . "Total: " . RESET . "$total files in queue.\n";
   
 # close connection  # close connection
 db_disconnect();  db_disconnect();
Line 126 
Line 137 
   
 sub db_select()  sub db_select()
 {  {
     $dbh->do("use Manager");      $dbh->do("use full_print");
 }  }
   
   
Line 136 
Line 147 
     my $i = 0;      my $i = 0;
     my $searchpath;      my $searchpath;
   
     $sth = $dbh->prepare ("SELECT NumCard,Path,time_file,file_priority,tx_count FROM upload_files WHERE Status=0 AND type_file=$type_file") or die "SQL prepare failed\n";      $sth = $dbh->prepare ("SELECT numcard,path,time_file,file_priority,tx_count FROM upload_files WHERE status=0 AND type_file=$type_file") or die "SQL prepare failed\n";
     $sth->execute( ) or die "unable to execute query $query   error $DBI::errstr";      $sth->execute( ) or die "unable to execute query $query   error $DBI::errstr";
   
     # zero elements      # zero elements
Line 151 
Line 162 
         }          }
         while( index($path[$i], ' ', 0) != -1 );          while( index($path[$i], ' ', 0) != -1 );
   
         $searchpath = substr($path[$i], 23);          # remove first 13 symbols in SMB path (\\fileserver\)
           $searchpath = substr($path[$i], 13);
   
         # hardcoded          # hardcoded
         $path[$i] = substr($path[$i], 30) if ($type_file == 0);          # remove first symbols to get only filename (i.e. \\fileserver\zayavki\ - 21 symbols)
         $path[$i] = substr($path[$i], 34) if ($type_file == 1);          $path[$i] = substr($path[$i], 21) if ($type_file == 0); #zayavki
         $path[$i] = substr($path[$i], 34) if ($type_file == 2);          $path[$i] = substr($path[$i], 19) if ($type_file == 1); #proba
           $path[$i] = substr($path[$i], 16) if ($type_file == 2); #TT
           $path[$i] = substr($path[$i], 18) if ($type_file == 2); #jpeg
   
             # make local file path              # make local file path
             $searchpath =~ tr/\\/\//; $searchpath = '/WIDEPRINT/' . $searchpath;              $searchpath =~ tr/\\/\//;
               $searchpath = '/mnt/maket/' . $searchpath;
             # follow symlink to achieve real path  
             chomp( $_ = `dirname $searchpath | xargs /usr/bin/readlink` ); chomp( $searchpath = $_ . '/' . `basename $searchpath` );  
   
             # finally, get file size              # finally, get file size
             $size[$i] = -s $searchpath;              $size[$i] = -s $searchpath;
             $size[$i] = ($size[$i] > 1048576 ? int($size[$i] / 1024 / 1024) . " MB" : int($size[$i] / 1024) . " KB");              $size[$i] = ($size[$i] > 1048576 ? int($size[$i] / 1024 / 1024) . " MB" : int($size[$i] / 1024) . " KB");
   
             # this should work fine              # this should work fine
             $size[$i] = WHITE ON_RED . "файл не найден" . RESET if (! -e $searchpath);              $size[$i] = WHITE ON_RED . "File not found" . RESET if (! -e $searchpath);
     $i++;      $i++;
     }      }
   

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.8

CVSweb