Return codes from preschedulecmd and postschedulecmd scripts

The return codes that you might see when you use the preschedulecmd and postschedulecmd options are described.

Windows operating systemsLinux operating systemsOracle Solaris operating
systemsAIX operating systemsMac OS X operating
systems
  • If the command specified by the preschedulecmd option ends with a nonzero return code, IBM® Storage Protect assumes that the command failed. In this case, the scheduled event and any postschedulecmd or postnschedulecmd command cannot run. The administrative query event command with format=detailed option shows that the event failed with return code 12.
  • If the command specified by the postschedulecmd option ends with a nonzero return code, IBM Storage Protect considers the command to be failed. The administrative query event command with format=detailed option shows that the event completed with return code 8. The exception is if the scheduled operation completed with a higher return code, in which case the higher return code takes precedence. Therefore, if the scheduled operation completes with return code 0 or 4 and the postschedulecmd command fails, the administrative query event command shows that the event completed with return code 8. If the scheduled operation completes with return code 12, that return code takes precedence, and query event shows that the event failed with return code 12.

Linux operating systemsOracle Solaris operating
systemsAIX operating systemsMac OS X operating
systemsWhen you interpret the return code from a command, IBM Storage Protect considers 0 to mean success, and anything else to mean failure. While this behavior is widely accepted in the industry, it is not 100% guaranteed. For example, the developer of the widget command might exit with return code 3, if widget ran successfully. Therefore, it is possible that the preschedulecmd or postschedulecmd command might end with a nonzero return code and still be successful. To prevent IBM Storage Protect from treating such commands as failed, you can wrap these commands in a script, and code the script so that it interprets the command return codes correctly. The script exits with return code 0 if the command was successful; otherwise it exits with a nonzero return code. The logic for a script running widget might look like this example:

Windows operating systemsWhen you interpret the return code from a command, IBM Storage Protect considers 0 to mean success, and anything else to mean failure. While this behavior is widely accepted in the industry, it is not 100% guaranteed. For example, the developer of the widget.exe command might exit with return code 3, if widget.exe ran successfully. Therefore, it is possible that the preschedulecmd or postschedulecmd command might end with a nonzero return code and still be successful. To prevent IBM Storage Protect from treating such commands as failed, you can wrap these commands in a script, and code the script so that it interprets the command return codes correctly. The script should exit with return code 0 if the command was successful; otherwise it should exit with a nonzero return code. The logic for a script that runs widget.exe might look like this example:

Linux operating systemsOracle Solaris operating
systemsAIX operating systemsMac OS X operating
systems
run 'widget'
   if lastcc == 3
      exit 0
   else
      exit 1
Windows operating systems
run 'widget.exe'
   if lastcc == 3
      exit 0
   else
      exit 1