Menu

Return Values

Help
2007-08-08
2013-04-23
  • Benedikt Hallinger

    Hi, first, thanks for this robust, easy and lean backup tool!

    I wonder what return values backup2l will throw and in which situations.
    The problem i have is, that i want to invoke a custom shell script after the backup was finished, but only in a situation where backup2l was able to complete the backup.
    What i want to do is to clean up  database table after the backup was made. But if i stupidly always clean, i loose data if backup2l cant back up the files because e.g. the disk was full.

    I thougt of modifying the cronjob command in such a way:
    backup2l -b && clean_database.sh
    but of course this only works, if backup2l returns correctly as needed here.

     
    • Gundolf Kiefer

      Gundolf Kiefer - 2007-08-27

      This is indeed an interesting question. In fact, I cannot tell or guarantee whether backup2l will really through a non-zero exit code in all possible error situations.

      This is a complex problem since there are lots of different error situations - e.g. the disk may be full, some tool (e.g. tar, afio) might be unavailable or print a mysterious error message, or the backing up of just few individual files might fail e.g. because they were modified during the backup process. In the latter case you might want to clean your database anyway unless the database itself was affected.

      This is what I propose and what is safe:

      After running 'backup2l -b', check whether a recent '*.errors.gz' file exists an if so, whether it is empty. If it does not exist, something bad happend, e.g. the disk is full or backup2l aborted for some other reason. If the file exists, backup2l is constructed such that all files not listed therein are archived correctly. You may even refine your script by checking the .errors.gz file for files related to your database.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.