Hi John, The idea behind PRESCHEDULECMD is that you have some task that must complete successfully prior to the scheduled operation, else there is no point in running the scheduled operation. Given that Spectrum Protect has no knowledge of what your tasks do, but that POSTSCHEDULECMD operations are typically based on the actions of the PRESCHEDULECMD, we deemed it generally "safer" to not potentially compound run-time problems by running the POSTSCHEDULECMD action if the PRESCHEDULECMD action was unsuccessful.
With that behavior being well defined, you can customize your PRESCHEDULECMD and POSTSCHEDULECMD actions to accommodate most situations. That is, your PRESCHEDULECMD operation could be a script that performs the desired actions, then exits with a return code of its choosing to determine whether it is safe for the scheduled operation to proceed. For example, suppose on a Windows system you want to stop some business critical application prior to running a backup, to help ensure that the application's data files are backed up in an integral state. In this case, you could do something like this: 1. Use PRESCHEDULECMD "net stop my_application" to stop the application before the backup begins. 2. Perform the scheduled backup 3. Use POSTSCHEDULECMD "net start my_application" to restart the application after the backup completes. If the PRESCHEDULECMD is unsuccessful (return code is nonzero), then the backup does not run. And since the application was not stopped, there is little point in trying to restart it. Now suppose that stopping the application is desired, but not required, to run the backup. In this case, you could wrap the "net stop" command in a script that always exits with return code 0; then use PRESCHEDULECMD "script_name". Similarly, you could write a POSTSCHEDULECMD script that restarts the application if it is not running, and exits with a return code of your choosing (e.g., some nonzero return code if you want the scheduler to report a warning-level return code to alert you to a potential problem). Best regards, Andy ____________________________________________________________________________ Andrew Raibeck | IBM Spectrum Protect Level 3 | [email protected] IBM Tivoli Storage Manager links: Product support: https://www.ibm.com/support/entry/portal/product/tivoli/tivoli_storage_manager Online documentation: http://www.ibm.com/support/knowledgecenter/SSGSG7/landing/welcome_ssgsg7.html Product Wiki: https://www.ibm.com/developerworks/community/wikis/home/wiki/Tivoli%20Storage%20Manager "ADSM: Dist Stor Manager" <[email protected]> wrote on 2016-06-20 04:53:29: > From: John Keyes <[email protected]> > To: [email protected] > Date: 2016-06-20 05:17 > Subject: Aw: Re: [ADSM-L] postschedulecmd question > Sent by: "ADSM: Dist Stor Manager" <[email protected]> > > I see, thank you. > It's a bummer really, since other backup solutions like bareos do > provide a more elaborate control over post schedule events. > > Best regards, > John > > > Gesendet: Donnerstag, 16. Juni 2016 um 15:46 Uhr > > Von: "Pagnotta, Pamela (CONTR)" <[email protected]> > > An: [email protected] > > Betreff: Re: [ADSM-L] postschedulecmd question > > > > Hi John, > > > > We use these commands sparingly so I am just reading the > documentation. The way I read the description, it seems as if the > postschedulecmd will run regardless of the return code of the actual > scheduled backup. > > > > Notes: > > If the postschedulecmd command does not complete with return code > 0, the client will report that the scheduled event completed with > return code 8 (unless the scheduled operation encounters a more > severe error yielding a higher return code). If you do not want the > postschedulecmd command to be governed by this rule, you can create > a script or batch file that invokes the command and exits with > return code 0. Then configure postschedulecmd to invoke the script > or batch file. The return code for the postnschedulecmd command is > not tracked, and does not influence the return code of the scheduled event. > > > > > > Also looking at the perschedulecmd notes, it says > > > > Note: > > Successful completion of the preschedulecmd command is considered > to be a prerequisite to running the scheduled operation. If the > preschedulecmd command does not complete with return code 0, the > scheduled operation and any postschedulecmd and postnschedulecmd > commands will not run. The client reports that the scheduled event > failed, and the return code is 12. If you do not want the > preschedulecmd command to be governed by this rule, you can create a > script or batch file that invokes the command and exits with return > code 0. Then configure preschedulecmd to invoke the script or batch > file. The return code for the prenschedulecmd command is not > tracked, and does not influence the return code of the scheduled event. > > > > > > So it appears that the postschedulecmd would run regardless of the > RC of the scheduled backup, but not if there is a non-zero RC during > the preschedulecmd. > > > > > > Pam > > > > Pam Pagnotta > > Sr. System Engineer > > Criterion Systems, Inc./ActioNet > > Contractor to US. Department of Energy > > Office of the CIO/IM-622 > > Office: 301-903-5508 > > Mobile: 301-335-8177 > > > > > > -----Original Message----- > > From: ADSM: Dist Stor Manager [mailto:[email protected]] On > Behalf Of John Keyes > > Sent: Thursday, June 16, 2016 9:28 AM > > To: [email protected] > > Subject: [ADSM-L] postschedulecmd question > > > > Hi guys, I did not find an answer on the internet to the followingquestion: > > Will a command defined as postschedulecmd be executed if the > schedule itself fails? > > > > Best regards, > > John > > >
