Preschedulecmd/Prenschedulecmd
The preschedulecmd option specifies a command that the client program processes before it runs a schedule.
The client program waits for the command to complete before it starts the schedule. If you do not want it to wait, specify prenschedulecmd.
- 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.
- The server can also define the preschedulecmd option (and the prenschedulecmd option).
Supported Clients
This option is valid for all clients. The IBM Spectrum Protect API does not support this option. The server can also define this option.
Options File
Place this option in the client system-options file (dsm.sys) within a server stanza. You can set this option on the Scheduler tab, in the Schedule Command dialog box in the Preferences editor.
Place this option in the client options file (dsm.opt). You can set this option on the Scheduler tab, in the Schedule Command dialog box in the Preferences editor.
Syntax
Parameters
- cmdstring
- Specifies the command to process. Use only one preschedulecmd option. You can
enter a command to be executed before a schedule using this option.
If the command string contains blanks, enclose the command string in quotation marks. If you placed quotation marks within the command string, then enclose the entire command string in single quotation marks.
Specify the command string just as you would enter it from the operating system command prompt; if the string you specify would require quotation marks to run it at a Windows prompt, include the quotation marks as needed. If the command string contains any blank spaces, enclose the command string in single quotation marks.
In this example, single quotation marks are needed because the command string contains space characters:'net stop someservice'
In this next example, double quotation marks are needed because both the file being renamed, and the new file name, contain space characters. Because the command string does contain space characters, the entire string must be enclosed in single quotation marks.presc 'rename "c:\myapp\log file.log" "log file.old"'
Use a blank or null string for cmdstring if you want to prevent any commands from running that the IBM Spectrum Protect server administrator uses for postschedulecmd and preschedulecmd. If you specify a blank or null string on either option, it prevents the administrator from using a command on both options.
If your administrator uses a blank or null string on the preschedulecmd option, you cannot run a pre-schedule command.
For Mac OS X, if the preschedulecmd schedule command is an AppleScript, you must use the osascript command to run the script. For example, ifDatabase Script
is an apple script, enter this command:preschedulecmd osascript "/Volumes/La Pomme/Scripting/ Database Script"
Examples
- Options file:
-
preschedulecmd "<the quiesce command of your database product> database"
The command string is a valid command for quiescing your database.
presc stopdb.cmd
presc 'rename c:\myapp\logfile.log logfile.old'
presc 'net stop "simple service"'
presc 'rename "c:\myapp\log file.log" "log file.old"'
presc '"C:\Program Files\MyTools\runreport.bat"
log1.in log2.in' - Command line:
-preschedulecmd="'quiesce database'"
- Command line:
-preschedulecmd='"quiesce database"'
This option is valid only on the initial command line. It is not valid in interactive mode.