5 minute read
A new DeltaBlue Cloud feature that will make life easier by defining when the platform should execute tasks for you!
We are excited to announce a new feature that will enable you to schedule platform actions. Right now, these platform actions exist of :
There are two ways to define a scheduled action: once or recurring.
Schedules can be defined on application level (launch / stop) or on scenario level. To get an overview of all the scheduled actions of your application, open the application and go to Actions -> Schedule.
As you can see in the image above, all three types of actions you can schedule are shown here where you can disable, edit or delete them. This is also the place to create a new one. Clicking the
+ button will open a modal window for the configuration.
In the screenshot of the modal window, you can see the timezone field. For schedules that need to be executed once, it’s possible to define in which timezone it has to be executed for the next execution date.
For recurring actions, keep in mind that the timezone for execution is in UTC. As can be seen in the screenshot of the schedule overview, the cron of the ‘Launch application’ action is set to
45 21 * * *. Tools like crontab.guru will tell you that the next execution date of this cron expression is set to 21:45. In the screenshot however, the next execution date is set to
25/07/2018 23:45, that is because the browser shows this time in the local timezone (GMT +02:00 in this case).
It is still possible to use your good old regular cron inside the application. The platform provides a task to do this. All you have to do is clone the sample task
CRON - SAMPLE - Set cron jobs which can be found under the Container utils. Edit and rename the cloned action to your needs with the desired cron syntax and shell commands to execute.
#------------------------------------- # Cron jobs #------------------------------------- # minute hour day month dayofweek user command # Sample every minute * * * * * root cd /opt/approot && your_command >/dev/null 2>&1
Typically a cron job contains 3 parts:
intervalexpressed in numbers or * which represents: minute hour day month dayofweek
userthat will execute the command
commandthat will be executed
In our example:
* * * * *which equals every minute
rootuser will execute the command
cd /opt/approot && your_command
If you want to capture the output in a file, add the following
>/opt/approot/cron.log 2>&1> after the command.
* * * * * root cd /opt/approot && your_command >/opt/approot/cron.log 2>&1>
If you want to skip the output capturing.
* * * * * root cd /opt/approot && your_command >/dev/null 2>&1
Why would you use the scheduler when you can still rely on a cron the server will execute? In fact, there are several reasons for it!