Created
December 31, 2020 10:39
-
-
Save tluyben/1ed5aa46bb12ab21c98136f050dcc21e to your computer and use it in GitHub Desktop.
counting new files per minute over 3k in a directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
$p = -1; | |
$intr = 2; | |
@minute = (); | |
while(1) { | |
$c = `find ./scraped -size +3k -ls|wc -l`; | |
chomp($c); | |
if ($p>=0) { | |
$t = $c - $p; | |
push @minute, $t; | |
if (scalar(@minute)>60/$intr) { | |
shift @minute; | |
} | |
$tm=0; | |
foreach(@minute) { | |
$tm+=$_; | |
} | |
print "Per $intr s: $t, per minute: $tm, per 15m: ".($tm*15).", per 30m: ".($tm*30).", per hour: ".($tm*60)." total current: $c\n"; | |
} | |
$p = $c; | |
sleep $intr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment