Command Scheduler
Description
Command Scheduler is a capability exposed through the Web Admin Console that allows administrators to schedule Command Line Shell Commands to be run at specified intervals.
Usage
The Command Scheduler allows administrators to schedule Command Line Shell Commands to be run in a "platform-independent" method. For instance, if an administrator wanted to use the Catalog commands to export all records of a Catalog to a directory, the administrator could write a cron job or a scheduled task to remote into the container and execute the command. Writing these types of scripts are specific to the administrator's operating system and also requires extra logic for error handling if the container is up. The administrator instead could simply create a Command Schedule, which currently requires only two fields. The Command Scheduler only runs when the container is running so there would be no need to verify if the container was up. In addition, when the container is restarted, the commands are rescheduled and executed again.
Scheduling a Command
- Navigate to the Web Admin Console
- Click on the Configuration tab.
- Find the Platform Command Scheduler configuration and click on the title or the "+" button. This will create a new configuration.
- Type the command or commands to be executed in the
Command
text field. Commands can be separated by a semicolon and will be executed in order from left to right. - Type in a positive integer for the
Interval In Seconds
field. - Click Save. Once the Save button has been clicked, the command will be executed immediately. It's next scheduled execution happens after the amount of seconds specified in
Interval In Seconds
and repeats indefinitely until the container is shutdown or the Scheduled Command is deleted.
Scheduled Commands can be update and deleted. To delete, click on the trash bin button to the right of the page. To update, modify the fields and click Save.
Updating a Scheduled Command
- Navigate to the Web Admin Console
- Click on the Configuration tab.
- Under the Platform Command Scheduler configuration are all the scheduled commands. Scheduled commands have the following syntax
ddf.platform.scheduler.Command.{GUID}
such asddf.platform.scheduler.Command.4d60c917-003a-42e8-9367-1da0f822ca6e.
- Find the desired configuration to modify and update either the
Command
text field or theInterval In Seconds
field or both. - Click Save. Once the Save button has been clicked, the command will be executed immediately. It's next scheduled execution happens after the amount of seconds specified in
Interval In Seconds
and repeats indefinitely until the container is shutdown or the Scheduled Command is deleted.
Command Output
Commands that normally write out to the console instead will write out to the distribution's log. For instance if an echo Hello World
command was to run every five seconds, the log would look like as follows:
16:01:32,582 | INFO | heduler_Worker-1 | ddf.platform.scheduler.CommandJob 68 | platform-scheduler | Executing command [echo Hello World] 16:01:32,583 | INFO | heduler_Worker-1 | ddf.platform.scheduler.CommandJob 70 | platform-scheduler | Execution Output: Hello World 16:01:37,581 | INFO | heduler_Worker-4 | ddf.platform.scheduler.CommandJob 68 | platform-scheduler | Executing command [echo Hello World] 16:01:37,582 | INFO | heduler_Worker-4 | ddf.platform.scheduler.CommandJob 70 | platform-scheduler | Execution Output: Hello World
In other words, administrators can see the status of a run within the log as long as INFO
was set as the status level.