1 Reply Latest reply on Sep 25, 2019 11:29 AM by Dude!

    crontab exceptions

    Robeen

      Solaris 11.4

       

      Hello,

       

      is there a way to add exceptions in crontab so that if 1 script fail, it will not execute the second one?

       

      Regards,

       

      Joe

        • 1. Re: crontab exceptions
          Dude!

          Not that I'm aware of but you can use some simple logic. For example:

           

          run.sh && success.sh || failure.sh

          ls myfile || echo failure

           

          It requires that scripts or commands provide an appropriate exit status, like 0 for success or 1 (exit 1) for failure. Alternatively you can also use some programing logic in scripts and make execution depending on certain files.