Commit bc281a9d authored by thomas.forbriger's avatar thomas.forbriger

csbackchk: give a clear statement in case of abort

parent ed0b66a8
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
# 14/07/2012 V0.4.1 provide more information in ERROR log messages # 14/07/2012 V0.4.1 provide more information in ERROR log messages
# 24/02/2013 V0.5 make use of reimplemented directory lock module # 24/02/2013 V0.5 make use of reimplemented directory lock module
# 28/02/2013 V0.6 improve error handling; use error codes # 28/02/2013 V0.6 improve error handling; use error codes
# 05/09/2019 V0.7 (thof): output a clear statement, that checks were not
# completed in case of abort
# #
# ============================================================================= # =============================================================================
...@@ -49,7 +51,7 @@ import csbacklog ...@@ -49,7 +51,7 @@ import csbacklog
import pidlock import pidlock
import csbackErrorCodes as eCodes import csbackErrorCodes as eCodes
__version__ = "V0.6" __version__ = "V0.7"
__license__ = "GPLv2+" __license__ = "GPLv2+"
__author__ = "Daniel Armbruster" __author__ = "Daniel Armbruster"
__copyright__ = "Copyright (c) 2012 by Daniel Armbruster" __copyright__ = "Copyright (c) 2012 by Daniel Armbruster"
...@@ -237,21 +239,33 @@ def main(argv=None): ...@@ -237,21 +239,33 @@ def main(argv=None):
logger.getLogger().info( \ logger.getLogger().info( \
"Check of files in '{0}' finished.".format(path[1])) "Check of files in '{0}' finished.".format(path[1]))
abortmessage="program aborts unexpectedly; checks are not completed!"
except Usage as err: except Usage as err:
sys.stderr.write(str(err)) sys.stderr.write(str(err))
return err.errorCode return err.errorCode
except pidlock.LockError as err: except pidlock.LockError as err:
logger.getLogger().error("{0}".format(err)) logger.getLogger().error("{0}".format(err))
sys.stderr.write(str(err)) sys.stderr.write(str(err))
logger.getLogger().error(abortmessage)
sys.stderr.write(abortmessage)
return err.errorCode return err.errorCode
except Error as err: except Error as err:
logger.getLogger().error("message: %s [CODE %s]", err.msg, err.errorCode) logger.getLogger().error("message: %s [CODE %s]", err.msg, err.errorCode)
sys.stderr.write(str(err)) sys.stderr.write(str(err))
logger.getLogger().error(abortmessage)
sys.stderr.write(abortmessage)
return err.errorCode return err.errorCode
except csfile.CsFileError as err: except csfile.CsFileError as err:
logger.getLogger().error("message: %s [CODE %s]", err.msg, err.errorCode) logger.getLogger().error("message: %s [CODE %s]", err.msg, err.errorCode)
sys.stderr.write(str(err)) sys.stderr.write(str(err))
logger.getLogger().error(abortmessage)
sys.stderr.write(abortmessage)
return err.errorCode return err.errorCode
except:
logger.getLogger().error("unknown execption!")
sys.stderr.write("unknown execption!")
logger.getLogger().error(abortmessage)
sys.stderr.write(abortmessage)
else: else:
logger.getLogger().info("Checks performed.") logger.getLogger().info("Checks performed.")
return 0 return 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment