From fb07450658d9a95caa5e980c0490adc22984a293 Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Wed, 26 Apr 2006 09:02:55 +0000 Subject: Check filesystem free space too and stop if full --- iurt2 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/iurt2 b/iurt2 index c7ea699..ff79be5 100755 --- a/iurt2 +++ b/iurt2 @@ -36,6 +36,7 @@ use File::NCopy qw(copy); use MIME::Words qw(encode_mimewords); use Fcntl ':flock'; use Mkcd::Commandline qw(parseCommandLine usage); +use Filesys::Df qw(df); my $program_name = 'iurt2'; # sessing parameters @@ -377,6 +378,12 @@ my $home = $config->{local_home}; my $union_id = 1; my $unionfs_tmp = $run{unionfs}; my $chroot_tmp = "$chroot.$run{run}"; + +my $df = df $home; +if ($df->{per} == 100) { + die "FATAL iurt: not enough space on the filesystem, only $df->{bavail}KB on $home, full at $df->{per}%" +} + foreach (my $i ; $i < @{$run{todo}}; $i++) { my ($dir, $srpm) = @{$run{todo}[$i]}; $done{$srpm} and next; @@ -940,6 +947,12 @@ sub perform_command { kill 14, "-$parent_pid"; exit } + my $df = df $opt{log} ; + if ($df->{per} == 100) { + print {$run{LOG}} "WARNING: killing current command because running out of disk space (only $df->{bavail}KB left)\n"; + kill 14, "-$parent_pid"; + exit + } $tot_time += sleep 30; } exit -- cgit v1.2.1