From db07203605bbcb6bb2ba4bd75922a814f853f425 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Sat, 23 May 2020 03:15:51 +0200 Subject: [PATCH] CPU priority reduced when compressing --- debian/changelog | 2 +- vn-vmware.pl | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index cbf3b40..4de8bdf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -vn-vmware (1.1.20) stable; urgency=low +vn-vmware (1.1.21) stable; urgency=low * Initial Release. diff --git a/vn-vmware.pl b/vn-vmware.pl index 8c3aeb9..f673224 100755 --- a/vn-vmware.pl +++ b/vn-vmware.pl @@ -602,7 +602,7 @@ sub backup_machine() { if (exists $config{pigz_processes}) { $pigz_processes = $config{pigz_processes}; } else { - $pigz_processes = int(Sys::CPU::cpu_count()) - 2; + $pigz_processes = int(Sys::CPU::cpu_count()); } $pigz_processes = max(1, $pigz_processes); @@ -618,12 +618,17 @@ sub backup_machine() { log_message "Compressing with Gzip (using $pigz_processes processes) to TAR file."; log_message $tar_command; + my $priority = getpriority(0, 0); + setpriority(0, 0, $priority + 10); + unless ($test) { my $tar_status = system($tar_command); unless ($tar_status == 0) { die "An error occurred when trying to compress '$vm_name' machine files."; } } + + setpriority(0, 0, $priority); }; my $err = $@;