Question

Is it possible to read the output of a batch script so that the JobScheduler generates an error code?

For example, if the file you want to copy does not exist or if it is not possible to establish a connection to an SFTP Server because the target host cannot be reached.

Answer

There are several approaches to handle exit codes and file transfer. The preferred solution depends on whether the respective job is an order job or standalone job and whether a shell or API script is being executed.

  • The simplest solution is to specify an exit code at the end of a shell script. For example:

    Example shell script exit function
     exit 5
    

The handling of exit codes is covered in two sections of our JobScheduler FAQs:

The example given in the original question concerns situations when, for example, files to be transferred were not available. This subject is covered seperately in:

Note that file transfer operations can often be conveniently carried out with our YADE application, and in particular with our YADE JITL Jobs that are fully integrated into JobScheduler.