]> git.pld-linux.org Git - packages/sysstat.git/commitdiff
- mv only if succeeded
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Sat, 30 Jan 2016 09:45:30 +0000 (10:45 +0100)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Sat, 30 Jan 2016 09:45:30 +0000 (10:45 +0100)
sysstat.spec

index bbc16b33e0e11d7a293a34a3f350119d76c6afa5..18f29154be753486ab4d400746b0b2c3830b7791 100644 (file)
@@ -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
 
This page took 0.040586 seconds and 4 git commands to generate.