diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2016-02-04 13:02:16 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2016-02-04 13:02:16 -0800 |
commit | dc29bbfa8748c369e0d24c029ecac07efd0f855f (patch) | |
tree | 34c4507374f8e12c173d511e8d89d36ce91dd1b2 /snapshots-create.sh | |
parent | snapshots-create: pixz causes SIGPIPE issues, try threaded xz instead. (diff) | |
download | mastermirror-scripts-dc29bbfa8748c369e0d24c029ecac07efd0f855f.tar.gz mastermirror-scripts-dc29bbfa8748c369e0d24c029ecac07efd0f855f.tar.bz2 mastermirror-scripts-dc29bbfa8748c369e0d24c029ecac07efd0f855f.zip |
snapshots-create: be nice about heavy CPU.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'snapshots-create.sh')
-rwxr-xr-x | snapshots-create.sh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/snapshots-create.sh b/snapshots-create.sh index a327522..e3837af 100755 --- a/snapshots-create.sh +++ b/snapshots-create.sh @@ -33,6 +33,9 @@ DELTA_FILENAME="portage-${DELTA_BASE}.tar.bz2" YESTERDAY=`/bin/date -d yesterday +%Y%m%d` FILENAME="portage-${YESTERDAY}.tar.bz2" +# Parallel compressors can use a LOT of cpu, be nice about it +NICE="nice -n 10" + # GPG info #SIGNKEYID="D8BA32AA" #SIGNKEYID="7DDAD20D" @@ -95,7 +98,7 @@ if [ ! -f "${FILENAME%.bz2}" ]; then fi fi [ ! -f " ${FILENAME}.umd5sum" ] && md5sum ${FILENAME%.bz2} > ${FILENAME}.umd5sum -[ ! -f "${FILENAME%.bz2}.bz2" ] && $BZIP2_PROG -k9 ${FILENAME%.bz2} +[ ! -f "${FILENAME%.bz2}.bz2" ] && ${NICE} $BZIP2_PROG -k9 ${FILENAME%.bz2} write_time_log "END TARBALL $(date -u)" # end 1) @@ -125,7 +128,7 @@ if [ ! -f "${FILENAME%.*}.xz" ] ; then # pxz: .tar -> .txz # # To avoid this, be explicit by using IO. - ${XZ_PROG} -9 -e <"${FILENAME%.*}" >"${FILENAME%.*}.xz" || exit $? + ${NICE} ${XZ_PROG} -9 -e <"${FILENAME%.*}" >"${FILENAME%.*}.xz" || exit $? fi write_time_log "END XZ $(date -u)" # end 3) @@ -150,9 +153,9 @@ write_time_log "END SIGN $(date -u)" write_time_log "START DELTA $(date -u)" PATCH=snapshot-${DELTA_BASE}-${YESTERDAY}.patch.bz2 if [ ! -f "${PATCH}" ]; then - ${BZIP2_PROG} -dkc ${UPLOAD}/${DELTA_FILENAME} > orig + ${NICE} ${BZIP2_PROG} -dkc ${UPLOAD}/${DELTA_FILENAME} > orig /usr/bin/differ -f bdelta orig ${FILENAME%.bz2} ${PATCH%.bz2} - ${BZIP2_PROG} -9 ${PATCH%.bz2} + ${NICE} ${BZIP2_PROG} -9 ${PATCH%.bz2} md5sum ${PATCH} > ${PATCH}.md5sum chmod 644 ${PATCH}{,.md5sum} mv ${PATCH}{,.md5sum} ${DELTA_UPLOAD} |