Email: bknpk@hotmail.com Phone: +972-54-7649119


V

 

A simple perl script, to wait till a given number of files stop changing, is described below:

  1. I needed today a script, that monitors on a given number of files, for no change by a running program. When all files stop to change, the program is killed. This was targeted to a program, which lacks the ability to close itself, when done or in idle.

  2. The script is invoked by the following way:

    perl ~/bin/wait_while_file_is_changed.pl veloce_transcript logs/moca2_chk.emu.log ; bkill 822525

    The first part fires the perl script with as much files as the user wishes to monitor and when the script detects no file change, it stops. Once stopped, the other command is executed.

  3. The script is listed below:

    #!/bin/perl

    $flg=1;
    $cnt=0;
    while($flg == 1) {

      foreach $file ( @ARGV ) {
        $cmd="ls -l " . $file;
        $f_date_last=`$cmd`;
        sleep 120;
        $f_date_curr=`$cmd`;
        $ix=index($f_date_last, $f_date_curr);
        if($ix == 0) {$cnt++;}
        $f_date_last=$f_date_curr;
      }

      $N=$#ARGV + 1;
      print("$cnt $N\n");
      if($cnt == $N) {
        $flg=0;
      }

      $cnt=0;
    }#while


  ...


Home

some memory VHDL models

A simple c-code program to read a memory array from verilog RTL, using VPI.






Search This Site


Feedback This Site




new pages on this site