diff options
-rwxr-xr-x | iurt2 | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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 |