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 I want to copy does not exist or it is not possible to make a connection to an SFTP Server because the target host cannot be reached.
Answer
There are several approaches to handling exit codes and file transfer. The exact solution depends on whether the job in question 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:
exit 5
The handling of exit codes themselves is covered in two sections of our JobScheduler FAQs:
- Error handling and, to a lesser extent,
- Shell jobs: starting scripts
The example described in the original question above concerned situations where, for example, files to be transferred are not available. This subject is covered seperately in:
Note that file transfer operations can often be conveniently carried out with our JADE application, and in particular with our JADE JITL template jobs that are fully integrated into JobScheduler.