@@ -26,6 +26,7 @@ use Osstest::Management qw(:logs);
use Fcntl qw(:flock);
our $dryrun= 0;
+our $force;
open DEBUG, ">/dev/null" or die $!;
@@ -34,6 +35,10 @@ while (@ARGV && $ARGV[0] =~ m/^\-/) {
last if $_ eq '--';
if (m/^-n$/) {
$dryrun= 1;
+ } elsif (m/^-(F+)$/) {
+ $force += length $1;
+ } elsif (m/^-F(\d+)$/) {
+ $force += $1;
} elsif (m/^-D$/) {
open DEBUG, ">&2" or die $!;
} else {
@@ -58,6 +63,11 @@ sub check_space () {
$!=0; $?=0; close P or die "$! $?";
my $space= $1;
printf "space: %8d, wanted: %8d ", $space, logcfg('MinSpaceMby');
+ if ($force) {
+ $force--;
+ printf "FORCING ";
+ return 0;
+ }
return $space >= logcfg('MinSpaceMby');
}
May be repeated (cuddled with itself) or given a number. Forces deletion, even if there is enough space. Normally clean up one less flight than specified, since cr-ensure-disk-space reruns its check after acquiring the lock. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> --- cr-ensure-disk-space | 10 ++++++++++ 1 file changed, 10 insertions(+)