Written by

While end­ing this year, we release all devel­op­ments that occurred dur­ing the last months, which are now ready to go in pro­duc­tion. We’ve got a lot of new fea­tures to improve your expe­ri­ence with your always­da­ta’s account.

Some Web apps or ser­vices some­times require you to run tasks peri­od­i­cal­ly. From a WordPress blog where you want to rely on an OS sched­uled tasks, to a bro­ker that you need to purge from its mes­sages queue peri­od­i­cal­ly, or an RSS feed read­er that you want it to retrieve its new arti­cles at a giv­en time, there’s plen­ty of use-cases.

The main point is: ser­vices may need to run com­mands, or get URLs, with­out any user inter­ac­tions. Every time you face this case, you need to reg­is­ter a sched­uled task.

Our plat­form use Debian as its base and you’ve got full access to your Unix account on the servers. It means you can reg­is­ter your tasks by edit­ing your user’s crontab with crontab -e.

For us, it wasn’t enough. For two rea­sons. The first one is that it splits the admin­is­tra­tion log­ic between our admin pan­el and the Unix sys­tem. The sec­ond one is the crontab syn­tax so dull.

The bonus1) point is also that a task sched­uled using crontab means its dec­la­ra­tion stays on a serv­er, which is not the serv­er that runs your ser­vices2). When we move your account to anoth­er serv­er3) we had to take care of poten­tial cron tables, which breaks the uni­ty and sim­plic­i­ty of our platform.

So, we added a Scheduled tasks sup­port direct­ly in your interface!

Administration Panel: Scheduled Tasks Interface
Administration Panel: Scheduled Tasks Interface

If you need to reg­is­ter a new task for any of your ser­vices, go to this new sec­tion in the admin­is­tra­tion pan­el and add a new task.

You have to fill in the form with few pieces of information:

  • The command(s) you want to run, or the URLs you want to GET: if you need to ping one or more URLs to trig­ger dis­tant ser­vices, just fill them in; oth­er­wise, declare the com­mand line to execute.
  • The peri­od­ic­i­ty you want the task to repeat. You can spec­i­fy a giv­en time or a time inter­val. If this field isn’t pow­er­ful enough for your need, feel free to come back to the crontab syn­tax to pre­cise­ly run your task.
Administration Panel: Create A New Task Interface
Administration Panel: Create A New Task Interface

That’s all. Your task is now reg­is­tered, and the plat­form takes care to run it.

About the WordPress exam­ple afore­men­tionned, you can reg­is­ter a task like php $HOME/wordpress/htdocs/wp cron event run --due-now that you can run every 10 min­utes4).

All timer fea­tures are also avail­able through the API, to allow you to eas­i­ly reg­is­ter pro­gram­mat­i­cal­ly any sched­uled task you need.

We do not rely on exist­ing cron tools for those tasks, but instead use our own imple­men­ta­tion: aljob. This for two reasons:

  1. Scheduled tasks aren’t exe­cut­ed right at the giv­en time, but in a minute range. It means that a task sched­uled at 00:00 will run at some point between 00:00:00 and 00:00:59. When you’ve got hun­dreds of tasks sched­uled at mid­night5), it pre­vents an over­load of the servers.
  2. If you often run a long task (e.g. every 10 min­utes), our dae­mon auto­mat­i­cal­ly detect that the pre­vi­ous task did­n’t exit­ed, and skip the new one, auto­mat­i­cal­ly pre­vent­ing the over­load and race con­di­tions in your long loop execution.

Want fun­ny stuff? You can run tasks even with­out any ser­vice installed in your account. Here’s a cus­tom com­mand I run every day:

It pings the DuckDuckGo news API and queries it about con­tents relat­ed to Google6), then fil­ter the returned JSON to extract the news’ title, URL, and date. It final­ly com­piles and sends it to my mail, so I’ve got my dai­ly digest about Google relat­ed stuff in my mailbox.

Scheduled tasks pan­el is now avail­able in your admin­is­tra­tion pan­el. We will remove the crontab sup­port for shared host­ing soon. If you rely on crontab for your tasks, they’ll be report­ed auto­mat­i­cal­ly to sched­uled tasks. VPS and Dedicated host­ing will have both sched­uled tasks and native crontab avail­able and can use what­ev­er solu­tion their prefer.

If you spot any improve­ment to this fea­ture, feel free to report it. We’re also curi­ous about what use you can have of the sched­uled tasks, use com­ments to sur­prise us!

Other fea­tures are on their way to pro­duc­tion. Stay tuned and keep an eye to our Twitter #advent thread as more news are coming.


1 and tech­ni­cal
2 our SSH servers and HTTP servers aren’t the same ones
3 which occur trans­par­ent­ly every day and then
4 do not for­get to dis­able the WordPress fake embed­ded cron by adding define('DISABLE_WP_CRON', true); in your wp-config.php file
5 like on our Shared host­ing plans
6 yeah, I like to troll them all