[packages/sysstat] - mv only if succeeded

arekm arekm at pld-linux.org
Sat Jan 30 10:45:35 CET 2016


commit 243b7463038749fa4ee327bfa2e0cdee52469fc6
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Jan 30 10:45:30 2016 +0100

    - mv only if succeeded

 sysstat.spec | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/sysstat.spec b/sysstat.spec
index bbc16b3..18f2915 100644
--- a/sysstat.spec
+++ b/sysstat.spec
@@ -128,10 +128,13 @@ fi
 for log in /var/log/sa/sa[0-9]*; do
 	if (LC_ALL=C %{_bindir}/sadf -C "$log" 2>&1 | grep -q "Current sysstat version cannot read the format of this file"); then
 		echo "Converting file $log to current format: "
-		%{_bindir}/sadf -c "$log" > "$log.migrate"
-		chown --reference "$log" "$log.migrate"
-		chmod --reference "$log" "$log.migrate"
-		mv "$log.migrate" "$log"
+		if (%{_bindir}/sadf -c "$log" > "$log.migrate"); then
+			chown --reference "$log" "$log.migrate"
+			chmod --reference "$log" "$log.migrate"
+			mv "$log.migrate" "$log"
+		else
+			echo "$log MIGRATION FAILED." >&2
+		fi
 	fi
 done
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/sysstat.git/commitdiff/243b7463038749fa4ee327bfa2e0cdee52469fc6



More information about the pld-cvs-commit mailing list