Scheduling Backup and Restore

This information Applies to TeamHeadquarters version 5.x only.

 

THQScheduler.js

Syntax

THQScheduler[.js] [/NEW:taskname | /OPEN:taskname] /RUNAS:username\password /WD:path

/COMMENT:"comment" /DELETEWHENCOMPLETE /RETAIN /START:yyyymmddThh:mm:ss

/END:yyyymmddThh:mm:ss /DISABLE /ENABLE /TERMINATE /RUN /MAXRUNTIME:time

/P:priority /INTERVAL:minutes /DURATION:minutes

/APP:application /PARMS:appparms

[/TYPE:[0 | 1 | 2 | 3 | 4]]

    (if Type=1) /DAILYINTERVAL:days

    (if Type=2) [/WEEKLYINTERVAL:weeks] [/WEEKLYDAYS:days]

    (if Type=3) [/MONTHLYDATEDAYS:days] [/MONTHLYDATEMONTHS:months]

    (if Type=4) [/MONTHLYDOWDAYS:days] [/MONTHLYDOWWEEK:week] [/MONTHLYDOWMONTHS:months]

 

Parameters

/NEW:taskname

Creates a new task. Fails if the task name already exists.

/OPEN

Opens an existing task. Fails if the task name doesn't exist.

/RUNAS:username\password

Sets the credentials to use when executing the scheduled request. Use "\" to run as SYSTEM. You must have administrative rights in order to schedule requests to run using the SYSTEM account.

/WD:path

Specifies the working directory for the task.

/COMMENT:"comment"

Provides a comment for the task.

/DELETEWHENCOMPLETE

Deletes the task when execution completes. This is the default behavior.

/RETAIN

Keeps the task when complete. Default behavior is to delete the task when execution has completed.

/START:yyyymmddThh:mm:ss

Specifies the date and time for the task schedule to become active.

/END:yyyymmddThh:mm:ss

Specifies the date and time for the task schedule to become inactive.

/DISABLE

Disables the task to prevent execution.

/ENABLE

Enables the task for execution.

/TERMINATE

Cancels an executing task.

/RUN

Immediately starts a scheduled task.

/MAXRUNTIME:time

Defines the maximum allowable execution time, in milliseconds.

/P:priority

Defines the execution priority of the task.

Values:

   NORMAL (default)

   IDLE

   HIGH

   REALTIME

/INTERVAL:minutes

Defines the time, in minutes, between successive task executions within the time specified by DURATION.

/DURATION:minutes

Defines the time, in minutes, within which the INTERVAL value is used. DURATION value must be greater than the value specified in INTERVAL.

/APP:application

The name of the executable program to run. If the application doesn't reside in the working directory or the system path, the full path to the executable must be provided.

/PARMS:"appparms"

The list of parameters to be passed to the application at execution time. The entire parameter list needs to be in double-quotes ("). The following special characters need to be encoded within the parm list to be handled properly:

Quote (") = "

Greater-than (>) = >

Less-than (<) = &lt;  

/TYPE:0

Runs the task once.

/TYPE:1

Runs the task daily, based on the DAILYINTERVAL parameter.

/DAILYINTERVAL:days

Specifies the number of days between task executions.

/TYPE:2

Runs the task weekly, based on WEEKLYINTERVAL and WEEKLYDAYS parameters.

/WEEKLYINTERVAL:weeks

Specifies the number of weeks between task executions.

/WEEKLYDAYS:days

Specifies the days of the week to run. Multiple values are separated by a comma, and spaces are not allowed. Allowable values are: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, ALL, WEEKDAYS, WEEKEND  

/TYPE:3

Runs the task monthly, based on MONTHLYDATEDAYS and MONTHLYDATEMONTHS parameters.

/MONTHLYDATEDAYS:dates

Specifies the days of the month to execute. Multiple values are spearated by a comma, and spaces are not allowed. Dates are specified as a number from 1 to 31.  

/MONTHLYDATEMONTHS:months

Specifies which months to execute on. Multiple values are separated by a comma, and spaces are not allowed. Allowable values are: JAN[UARY], FEB[RUARY], MAR[CH], APR[IL], MAY, JUNE, JULY, AUG[UST], SEP[TEMPBER], OCT[OBER], NOV[EMBER], DEC[EMBER], ALL  

/TYPE:4

Runs the task monthly, based on the MONTHLYDOWDAYS, MONTHLYDOWWEEK, and MONTHLYDOWMONTHS parameters.

/MONTHLYDOWDAYS:dates

Specifies the days of the week to run. Multiple values are spearated by a comma, and spaces are not allowed. Allowable values are: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, ALL, WEEKDAYS, WEEKEND  

/MONTHLYDOWWEEK:weeks

Specifies the relative week to run. Multiple values are spearated by a comma, and spaces are not allowed. Allowable values are: FIRST, SECOND, THIRD, FOURTH, LAST  

/MONTHLYDOWMONTHS:months

Specifies which months to execute on. Multiple values are separated by a comma, and spaces are not allowed. Allowable values are: JAN[UARY], FEB[RUARY], MAR[CH], APR[IL], MAY, JUNE, JULY, AUG[UST], SEP[TEMPBER], OCT[OBER], NOV[EMBER], DEC[EMBER], ALL  

   

   

      

Examples

Click the heading to toggle the display of the sample code

Create a new task to execute once on Jan 2, 2003 at 9pm. Delete the task when complete.

THQScheduler /NEW:Example1 /Start:20030102T21:00:00 /APP:MyApp.exe

Create a new task to execute every 5 minutes for 1 hour.

THQScheduler /NEW:Example2 /APP:MyApp.exe /Duration:60 /Interval:5

Create a new task to perform a full backup of the TeamHeadquarters database every Sunday morning at 4am, starting after June 1, 2002.

THQScheduler /NEW:THQBackupFull /WD:D:\XOM\BIN /APP:THQBackup.exe /RUNAS:\ /TYPE:2
/WEEKLYINTERVAL:1 /WEEKLYDAYS:SUNDAY /START:20020601T04:00:00
/COMMENT:"TeamHeadquarters Full Database Backup"
/PARMS:"/D /F:D:\XOM\Backups\DatabaseBackupFull /O /C /RESET"

Create a new task to perform an incremental backup of the TeamHeadquarters database every Monday at 4am, starting June 1, 2002.

THQScheduler /NEW:THQBackupMonday /WD:D:\XOM\BIN /APP:THQBackup.exe /RUNAS:\ /TYPE:2
/WEEKLYINTERVAL:1 /WEEKLYDAYS:MONDAY /START:20020601T04:00:00
/COMMENT:"TeamHeadquarters Incremental Database Backup"
/PARMS:"/I /F:D:\XOM\Backups\DatabaseBackupMonday /O /C /RESET"

Create a new task to perform a cumulative incremental backup of the TeamHeadquarters database every day except Sunday, at 2am, starting June 1, 2002.

THQScheduler /NEW:THQBackupDaily /WD:D:\XOM\BIN /APP:THQBackup.exe /RUNAS:\ /TYPE:2
/WEEKLYINTERVAL:1 /WEEKLYDAYS:MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY
/START:20020601T04:00:00 /COMMENT:"TeamHeadquarters Cumulative Incremental Database Backup"
/PARMS:"/I /D /F:D:\XOM\Backups\DatabaseBackupIncremental /O /C"

Create a new task to perform a full TeamHeadquarters system backup on the last Saturday of every month, at 3am, starting June 1, 2002.

THQScheduler /NEW:THQBackupDaily /WD:D:\XOM\BIN /APP:THQBackup.exe /RUNAS:\ /TYPE:4
/MONTHLYDOWWEEK:LAST /MONTHLYDOWDAYS:SATURDAY /MONTLYDOWMONTHS:ALL
/START:20020601T03:00:00 /COMMENT:"TeamHeadquarters Full System Backup"
/PARMS:"/S /F:D:\XOM\Backups\SystemBackup /O /C"

Open an existing scheduled task and change the execution credentials to run as SYSTEM.

THQScheduler /OPEN:ExampleTask /RUNAS:\