blob: 07336e3c2d23e01a3b7f92c52082366e42ee34c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/perl
# -*- cperl -*-
use strict;
use Getopt::Long;
use IO::File;
my $vardir;
my $randie= 0;
my $sleep= 0;
GetOptions
(
# Directory where to write files
'vardir=s' => \$vardir,
'die-randomly' => \$randie,
'sleep=i' => \$sleep,
);
die("invalid vardir ") unless defined $vardir and -d $vardir;
my $pid= $$;
while(1){
for my $i (1..64){
# Write to file
my $name= "$vardir/$pid.$i.tmp";
my $F= IO::File->new($name, "w")
or warn "$$, Could not open $name: $!" and next;
print $F rand($.) for (1..1000);
$F->close();
sleep($sleep);
die "ooops!" if $randie and rand() < 0.0001
}
}
exit (0);
|