We know you have been waiting for this. And it's finally here!
We have some cool news: you can now run Cron tasks on Jelastic! Thanks to all of our active users, this great feature is now available in Jelastic PaaS.
We have added this new capability via our new VDS feature.
Note: this feature is available starting with Jelastic version 1.8.2 and is a paid add-on.
Before we install it, let's do a quick recap of what cron is and why so many developers love it.
Basicaly,cron is the time-based job scheduler in Unix-like OSs. Server and website administration can be automated and simplified with the use of Cron jobs. Cron jobs are commonly used by webmasters to schedule mundane, time-consuming and repetitive tasks that can be handled by simple programming. Cron jobs are constantly running in the background on the web server and are powered by files known as crontabs, which contain all of the timing and task execution details.
And now Jelastic gives you the capability to run your programs at a specified time with a help of cron, which receives your instructions and performs any tasks following derived scenarios. You can use this opportunity to perform periodic tasks. To do this, just follow these instructions: start by creating an environment and establishing an SHH connection as described here.
Setting up cron
1. First of all you need to decide which program you want to run and get its full path at the server disk. The path can look like: /your_directory/whatever.pl.
2. In the opened console (which you've got after your SSH connection) enter the command:
3. Write the schedule for your task in such a way that cron tab will understand it.
The basic format of a crontab schedule consists of 6 fields, separated by spaces, formatted as follows:
minute hour day month day-of-week command-line-to-execute
The acceptable values for each of the 6 fields are:
Range of values
0-7 (where both 0 and 7 mean Sun,
1 = Mon, 2 = Tue, etc)
the path to the program you want to run
The fields have to be in that exact order, with no empty or missing fields.
If needed you can use a wildcard character - "*" (the asterisk). In a crontab file it represents every possible value for the field. For example, specifying :*" in the "hour" means "to run every hour."
'/' character is used to specify additional frequency assignments. For example, '* / 3' in the "hour" means "every three hours."
For each individual parameter, you can specify multiple values separated by commas. For example, if in the "hour" you type 1,6,19, the job will run at 1:00 am, at 6:00 am and 19 hours. You can also specify the interval, for example, 8-17 would mean that the program will be run every hour from 8 to 17 inclusive.
So, for example, your command line can look like this:
And in this case it means that the /your_directory/whatever.pl. program will be run every 3 hours.
If you want to run PHP-scripts with the stated period, you can do that with a help of wget. For that the command-line-to-execute should look like the next example:
To save and exit type :q and press Enter.
Congratulations! You have now scheduled your tasks.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.