Scheduling Actions with NodeJS

Intro

The Schedule options allow you to create actions that run at scheduled times. The scheduled actions run without the need of your page to be loaded in your browser. This is useful if you want to run daily or hourly tasks. In our example we will show you how to clear the contents of a folder every day.

This option is only available for NodeJS projects.

Scheduled Actions

Creating a Scheduled Action

First, right click Schedule in Server Connect panel:

And add a Scheduled Action:

Add a name for you scheduled action:

Adding Steps to the Scheduled Action

Then we need to add the steps which should be executed. Right click steps:

Under File Management we select Empty Folder:

Select the folder which contents you want to clear:

Browse to the folder and click Select:

Set up Schedule

Now, after we’ve set up the steps to be executed, we need to setup the schedule for this action.
Click Schedule:

The default Schedule Settings are set to Every 15 minutes. We’d like to set a different period - every day. Open the period menu:

And select Daily:

Select the interval - we set this to every 1 day. You can change this according to your needs:

And then we set the time, when the action should be executed every day:

Click Save an you are done:

Now our folder will be emptied every day at 17:45.

13 Likes

What a perfect timing! Just what I needed for my new upload module!

2 Likes

Awesome new feature, would also be nice if we could schedule an action to run based on certain fields like lets say a date time picker.

Will it be possible to use existing Server Actions?

1 Like

You can use actions from the library and include or execute them.

Library is ment for sharing

1 Like

Awesome stuff guys. Great timing for me as I was about to have to look into how to run Cron jobs on the server. Now I don’t have to.

Brilliant!

1 Like

I am assuming this could actually replace running cron jobs on the server, for example, to periodically check a database table for updates?

Thanks.

Yes you can schedule all king of automatic server side work with the new schedule indeed.

1 Like

What does the implementation look like? I haven’t been able to update yet unfortunately.

Where is the info for the job stored? File? environment variables? DB?
In other words, are the jobs environment dependent? Or landscape-wide?

4 posts were split to a new topic: Scheduled action: database update

I think a new SC action to backup the database would be handy if paired with the jobs and S3 upload or email.

Maybe even a new section called “Job Manager” similar to “DB Manager” to manage jobs remotely, thus my questions above.

2 Likes