Tomas Golembiovsky has uploaded a new change for review.
Change subject: vdsm: report correct exit value in vdsm-logrotate ......................................................................
vdsm: report correct exit value in vdsm-logrotate
The exit code was reported improperly. If all but the last command had failed we would still return 0. Now we are reporting exit code of last failed command or 0 when all exited successfully.
Change-Id: I29df6cac36c64be2bf20337ab096ec471d864ca5 Signed-off-by: Tomáš Golembiovský tgolembi@redhat.com --- M vdsm/vdsm-logrotate 1 file changed, 8 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/65603/1
diff --git a/vdsm/vdsm-logrotate b/vdsm/vdsm-logrotate index a29cbe5..e44e079 100755 --- a/vdsm/vdsm-logrotate +++ b/vdsm/vdsm-logrotate @@ -17,17 +17,19 @@
if [ -d /var/log/core ] ; then /usr/bin/find /var/log/core -type f -name '*xz' -mtime +7 -exec /bin/rm -f '{}' ; - EXITVALUE=$? - if [ $EXITVALUE != 0 ]; then - /usr/bin/logger -t logrotate "ALERT clean old core files exited abnormally with [$EXITVALUE]" + RET=$? + if [ $RET != 0 ]; then + /usr/bin/logger -t logrotate "ALERT clean old core files exited abnormally with [$RET]" + EXITVALUE=$RET fi fi
if [ -d /var/log/vdsm/import ] ; then /usr/bin/find /var/log/vdsm/import -type f -mtime +30 -exec /bin/rm -f '{}' ; - EXITVALUE=$? - if [ $EXITVALUE != 0 ]; then - /usr/bin/logger -t logrotate "ALERT clean of old import log files exited abnormally with [$EXITVALUE]" + RET=$? + if [ $RET != 0 ]; then + /usr/bin/logger -t logrotate "ALERT clean of old import log files exited abnormally with [$RET]" + EXITVALUE=$RET fi fi