Import Cron and Windows Task Scheduler

How to import a Cron or Windows Task Scheduler job by using the Dynamic Workload Console.

Before you begin

You can use this procedure to import Cron or Windows Task Scheduler jobs into an HCL Workload Automation distributed environment that has a dynamic agent, by using the Dynamic Workload Console. Before starting to import, ensure that you have generated your Cron or Windows Task Scheduler files. Run the command crontab -l, on the machine where you created your Cron definitions, to display and save them in a file. Export your Windows Task Scheduler definitions from the Windows Task Scheduler panel and save it as an xml file. Use a zip file to import more than one xml file. You can now import your Cron or Windows Task Scheduler files into HCL Workload Automation.

About this task

Import a Cron or Windows Task Scheduler job to take advantage of the powerful scheduling capabilities of HCL Workload Automation. You can use the Dynamic Workload Console to read crontab files or Windows Task Scheduler jobs and convert them into HCL Workload Automation objects. The jobs are added to your workload with the same specifications as the original jobs. The job streams reflect the time definition of the cron or Windows Task Scheduler commands. You can then modify, schedule, and monitor them together with all your other objects.

To manage your Cron or Windows Task Scheduler jobs in your HCL Workload Automation environment, complete the following steps:

Procedure

  1. From the navigation toolbar, click Design >Import Definitions
  2. Select the engine on which you want the job to run.
  3. Browse for and select your Cron or Windows Task Scheduler file and click Upload.
  4. HCL Workload Automation identifies the file type and the wizard changes accordingly:
    Cron files
    Select the user to run the command specified in the cron file. You can choose between:
    Defined in the file
    The user that runs the command is defined in the cron file, before the command definition in the rule. This is the default value.
    User name
    Select to specify the user that runs the command.
    One job is created for each command in the file. Each job is scheduled to run independently of the other jobs, as defined in the cron file. A default editable name is given to the job stream and job that will be created.
    Windows Task Scheduler files
    Specify the agent where you want the process to run. A single job stream is created for all commands in the xml file, which are inserted in the job stream as jobs. To import multiple Windows Task Scheduler files, compress them in a zip file and import it.
    Previously exported HCL Workload Automation job stream
    Specify the agent where you want the process to run.
  5. Optionally, specify the prefix to apply to the imported object.
  6. Optionally, check the box to not import a specific definition.
  7. Click Import. Your scheduler files are now imported and available for use in the Dynamic Workload Console.

Results

Click Open job streams to open the job stream in the Workload Designer. You can now manage, schedule, and monitor your Cron or Windows Task Scheduler job like any other job in the Dynamic Workload Console.
The following example shows a Windows Task Scheduler input definition file:
˂?xml version="1.0" encoding="UTF-16"?>
˂Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  ˂RegistrationInfo>
    ˂Date>2016-12-27T16:09:03.2293491˂/Date>
    ˂Author>NX051050\Administrator˂/Author>
  ˂/RegistrationInfo>
  ˂Triggers>
    ˂TimeTrigger>
      ˂StartBoundary>2016-12-27T16:08:33.47795˂/StartBoundary>
      ˂Enabled>true˂/Enabled>
    ˂/TimeTrigger>
  ˂/Triggers>
  ˂Principals>
    ˂Principal id="Author">
      ˂UserId>NC051050\Administrator˂/UserId>
      ˂LogonType>InteractiveToken˂/LogonType>
      ˂RunLevel>LeastPrivilege˂/RunLevel>
    ˂/Principal>
  ˂/Principals>
  ˂Settings>
    ˂MultipleInstancesPolicy>IgnoreNew˂/MultipleInstancesPolicy>
    ˂DisallowStartIfOnBatteries>true˂/DisallowStartIfOnBatteries>
    ˂StopIfGoingOnBatteries>true˂/StopIfGoingOnBatteries>
    ˂AllowHardTerminate>true˂/AllowHardTerminate>
    ˂StartWhenAvailable>false˂/StartWhenAvailable>
    ˂RunOnlyIfNetworkAvailable>false˂/RunOnlyIfNetworkAvailable>
    ˂IdleSettings>
      ˂StopOnIdleEnd>true˂/StopOnIdleEnd>
      ˂RestartOnIdle>false˂/RestartOnIdle>
    ˂/IdleSettings>
    ˂AllowStartOnDemand>true˂/AllowStartOnDemand>
    ˂Enabled>true˂/Enabled>
    ˂Hidden>false˂/Hidden>
    ˂RunOnlyIfIdle>false˂/RunOnlyIfIdle>
    ˂WakeToRun>false˂/WakeToRun>
    ˂ExecutionTimeLimit>P3D˂/ExecutionTimeLimit>
    ˂Priority>7˂/Priority>
  ˂/Settings>
  ˂Actions Context="Author">
    ˂Exec>
      ˂Command>C:\Users\Administrator\Desktop\wts.bat˂/Command>
    ˂/Exec>
  ˂/Actions>
˂/Task>
The following example shows a Cron input definition file:
*/10 13 26 10 * echo hello world

Limitations

About this task

There are some limitations that do not permit the import of a Cron or Windows Task Scheduler job:
Cron
  • You can use commas only for the second, third, and fifth fields, indicating the hour and the day of the month, respectively. In all other fields, you must use the dash (-) to indicate a range. For example, a range from one to five must be specified as follows: 1-5. Consider the following example, in which you specify that the job must run on the 30th day of each month once a minute, from 12;30 AM to 12;35 AM and from 12;30 PM to 12;35 PM:
    30-35 0,12 30 * *
  • The range-type syntax is not supported in the month field (penultimate) of the rule.
  • In the last field of the rule, you can use a value between zero or seven and six only if in both the third and fourth field the value provided is *. In all other cases, the value of the last field must be *. The zero and seven values both indicate Sunday and can be used interchangeably.
Windows Task Scheduler
  • Operating-system dependent options are not supported.
  • Triggers are supported only if based on a schedule. The related advanced settings are not supported.
  • Only the Start a program action is supported.
  • Conditions are not supported.
  • Hidden rules are not supported.
  • Rules configured for specific operating systems are not supported.
  • Choosing the user account with which you run the task is supported.
  • Specifying how often the task should run is not supported.
  • Settings are supported only for the rule applied if the task already running. The option "Stop the existing instance" is not supported.