#1089 Issue closed: in messages/syslog we find "DONE: rc=0" after a rear run - make it more meaningful

Labels: enhancement, fixed / solved / done

gdha opened issue at 2016-11-28 11:01:

Exit code in messages file improvement

  • rear version (/usr/sbin/rear -V): v2.0
  • OS version (cat /etc/rear/os.conf or lsb_release -a): n/a

example:

# grep DONE /var/log/messages
Nov 25 17:20:45 client rear[14341]: DONE: rc=0

Would be better to see something like: Workflow backup: rc=0
Are there any other (better) suggestions?

jsmeix commented at 2016-12-14 09:16:

@gdha
what does 'rc' mean here?

According to
http://superuser.com/questions/173165/what-does-the-rc-in-bashrc-etc-mean
http://unix.stackexchange.com/questions/111611/what-does-the-rc-stand-for-in-etc-rc-d
https://en.wikipedia.org/wiki/Run_commands
usually 'rc' means "run commands" which cannot be meant here.

I guess here 'rc' could mean "return code" but this is not a function
so that I would prefer to name it as what it actually is: "exit code"

I suggest the following in usr/sbin/rear

if test $EXIT_CODE -eq 0 ; then
    LogToSyslog "$PROGRAM $WORKFLOW finished with zero exit code"
else
    LogToSyslog "$PROGRAM $WORKFLOW failed with exit code $EXIT_CODE"
fi

Note that I do not use "succeeded with zero exit code"
to avoid false hope because a zero exit code does
not necessarily mean that everything was o.k.

jsmeix commented at 2016-12-14 09:24:

By the way:
@gdha @schlomo
do you know why the help workflow sets EXIT_CODE=1
in lib/help-workflow.sh?
According to "git log -p usr/share/rear/lib/help-workflow.sh"
that was implemented by Schlomo Schapiro in
https://github.com/rear/rear/commit/f57be9070cb8ad8692497d0baedf364b47ac7a8d

jsmeix commented at 2016-12-14 11:48:

Regarding help workflow sets EXIT_CODE=1 see
https://github.com/rear/rear/pull/1126

jsmeix commented at 2016-12-15 14:35:

With https://github.com/rear/rear/pull/1126 merged
the help workflow exits now with zero exit code.

jsmeix commented at 2016-12-15 16:13:

For the ReaR 2.0 major version bump
there can be changes in the texts so that I implemented
https://github.com/rear/rear/issues/1089#issuecomment-266983001
via
https://github.com/rear/rear/pull/1130
that I will merge tomorrow if there are no objections.

jsmeix commented at 2016-12-16 09:41:

With https://github.com/rear/rear/pull/1130 merged
I consider this issue to be fixed, cf.
https://github.com/rear/rear/issues/1073#issuecomment-267555036


[Export of Github issue for rear/rear.]