aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2006-04-26 09:02:55 +0000
committerFlorent Villard <warly@mandriva.com>2006-04-26 09:02:55 +0000
commitfb07450658d9a95caa5e980c0490adc22984a293 (patch)
tree1a13f6c751255c900512797a20b7bd04f221a9b2
parent431a96c41c0c94f84f6abffb51aea4738df7e278 (diff)
downloadiurt-fb07450658d9a95caa5e980c0490adc22984a293.tar
iurt-fb07450658d9a95caa5e980c0490adc22984a293.tar.gz
iurt-fb07450658d9a95caa5e980c0490adc22984a293.tar.bz2
iurt-fb07450658d9a95caa5e980c0490adc22984a293.tar.xz
iurt-fb07450658d9a95caa5e980c0490adc22984a293.zip
Check filesystem free space too and stop if full
-rwxr-xr-xiurt213
1 files changed, 13 insertions, 0 deletions
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