From: Arvin Schnell Date: Fri, 4 Mar 2011 14:49:27 +0000 (+0100) Subject: - be "nice" during background tasks X-Git-Tag: v0.1.3~431 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ad882b09f27f084c10ffe7f6d182a3ac9f0e5f8f;p=thirdparty%2Fsnapper.git - be "nice" during background tasks --- diff --git a/scripts/snapper-daily b/scripts/snapper-daily index 4a78a130..197380a0 100755 --- a/scripts/snapper-daily +++ b/scripts/snapper-daily @@ -16,6 +16,13 @@ if [ -f /etc/sysconfig/snapper ] ; then fi +# +# be nice +# +/usr/bin/renice -n 19 -p $$ +/usr/bin/ionice -c 3 -p $$ + + # # run snapper for all configs # diff --git a/scripts/snapper-hourly b/scripts/snapper-hourly index 8f2d41fc..3a8ef73c 100755 --- a/scripts/snapper-hourly +++ b/scripts/snapper-hourly @@ -16,6 +16,13 @@ if [ -f /etc/sysconfig/snapper ] ; then fi +# +# be nice +# +/usr/bin/renice -n 19 -p $$ +/usr/bin/ionice -c 3 -p $$ + + # # run snapper for all configs # diff --git a/snapper.spec.in b/snapper.spec.in index 927707cd..8e66d1b3 100644 --- a/snapper.spec.in +++ b/snapper.spec.in @@ -57,7 +57,7 @@ rm -rf "$RPM_BUILD_ROOT" %package -n libsnapper Summary: Library for filesystem snapshot management Group: System/Libraries -Requires: btrfsprogs diffutils +Requires: btrfsprogs diffutils util-linux PreReq: %fillup_prereq %description -n libsnapper diff --git a/snapper/Snapper.cc b/snapper/Snapper.cc index 7de9f0cb..308e95ba 100644 --- a/snapper/Snapper.cc +++ b/snapper/Snapper.cc @@ -150,7 +150,8 @@ namespace snapper string output = snapshot2->baseDir() + "/filelist-" + decString(snapshot1->getNum()) + ".txt"; - SystemCmd(COMPAREDIRSBIN " " + quote(dir1) + " " + quote(dir2) + " " + quote(output)); + SystemCmd(NICEBIN " -n 19 " IONICEBIN " -c 3 " COMPAREDIRSBIN " " + quote(dir1) + " " + + quote(dir2) + " " + quote(output)); } diff --git a/snapper/SnapperDefines.h b/snapper/SnapperDefines.h index ca384762..da81b465 100644 --- a/snapper/SnapperDefines.h +++ b/snapper/SnapperDefines.h @@ -33,6 +33,9 @@ #define COMPAREDIRSBIN "/usr/lib/snapper/bin/compare-dirs" +#define NICEBIN "/usr/bin/nice" +#define IONICEBIN "/usr/bin/ionice" + #define CPBIN "/bin/cp" #define DIFFBIN "/usr/bin/diff"