Using automated tasks on a Web Hosting plan
Objective
On OVHcloud Web Hostings, you can use scripts to automate certain operations. Creating a scheduled task ("cron job") is the easiest way to ensure your scripts are running at specific times without further actions necessary on your part.
This guide explains how to create cron jobs to automate scheduled tasks on a Web Hosting.
OVHcloud provides services that you are responsible for with regard to their configuration and management. It is therefore your responsibility to ensure that they function properly.
This guide is designed to help you with common tasks. Nevertheless, we recommend contacting a specialist provider or reach out to the OVHcloud community if you encounter any difficulties. We will not be able to assist you. You can find more information in the Go further section of this guide.
Requirements
OVHcloud Control Panel Access
- Direct link: Hosting plans
- Navigation path:
Web Cloud>Hosting plans> Select your web hosting plan
Instructions
Log in to your OVHcloud Control Panel and select Web Cloud in the top navigation bar. Click Hosting plans, then choose the Web Hosting plan concerned. Next, navigate to the cron tab by selecting it in the More submenu.
In this section you will see an overview of your scheduled jobs and their settings.
Creating an automated task
Step 1: Defining general settings
To create a new cron task, click on the Add a scheduling button on the right-hand side. You can customise the settings for the task in the new window.
Click on Next to proceed to the second step.
Step 2: Setting the frequency
The interface offers two modes to configure the frequency of your task. Use the Basic mode for a beginner-friendly selection of scheduling options. If you prefer to directly enter a frequency, similar to a cron table format (crontab), choose the Advanced mode.
The Days form allows you to define execution frequencies on a monthly cycle.
The Days of the week form allows you to define additional execution frequencies, but on a weekly cycle.
You can switch between the two modes during configuration to view the changes accordingly. Please also note the limitations when scheduling a task on a Web Hosting.
Step 3: Finishing the setup
The summary lists all your settings including the crontab notation of the execution frequency. If everything is correct, click on Confirm.
The task will be ready within a few minutes. You can then modify all of its settings or delete the task by clicking on ... in the overview table in your OVHcloud Control Panel.
Modify or delete a scheduled task
Click on the tabs below to view each of the 3 steps.
Go to the Hosting plans page, then select the web hosting plan concerned.

Limitations of Web Hosting tasks
Troubleshooting
Testing your script with a web browser
A simple test to see if your script will produce an error is to run it in a web browser. For example, if the file path of your script is "www/cron.php" and your hosting domain is "mypersonaldomain.ovh", you would use the URL "http://mypersonaldomain.ovh/cron.php". If no error is showing up but the script is not performing as expected, follow up with the suggestions below.
Verifying the usage of absolute paths
Always make sure to use absolute paths to files in your scripts. The "DIR" constant, for example, can help to receive the current path in PHP scripts (PHP documentation).
Checking your execution logs
In your Web Hosting's logs, accessible from the OVHcloud Control Panel, you will see the log category labelled "cron".
Please refer to this guide for details.
Example logs
- Example of a successfully finished execution output
[2023-08-11 00:36:01] ## OVH ## START - 2023-08-11 00:36:01.524384 executing: /usr/local/php7.2/bin/php /homez.161/myftpusername/www/myscript.sh
[2023-08-11 00:36:01]
[2023-08-11 00:36:01] ## OVH ## END - 2023-08-10 22:39:44.086166 exitcode: 0
- Example of a failed execution output due to exceeded execution time
[2023-08-11 00:36:01] ## OVH ## START - 2023-08-11 00:36:01.524384 executing: /usr/local/php7.2/bin/php /homez.161/myftpusername/www/sleep.sh
[2023-08-11 01:36:01] ## OVH ## ERROR - CRON TASK INTERRUPTED BY OVH - reason: your script duration exceeded the maximum permitted (3600 seconds)
[2023-08-11 01:36:01] ## OVH ## END - 2023-08-11 01:36:01.086166 exitcode: 0
- Example of a failed execution output because the script file was not found in the specified path
[2023-08-11 00:36:01] ## OVH ## START - 2023-08-11 00:36:01.524384 executing: /usr/local/php7.2/bin/php /homez.161/myftpusername/www/noscript.sh
[2023-08-11 00:36:01] ## OVH ## ERROR command '/homez.161/myftpusername/www/noscript.sh' not found
[2023-08-11 00:36:01] ## OVH ## END - 2023-08-11 00:36:01.086166 exitcode: 255
- Example of a failed execution output because of a permissions error (chmod) or incorrect configuration of the .ovhconfig file
[2023-08-11 18:07:10] ## OVH ## Your job could not be initiated for an unknown reason.
[2023-08-11 18:07:10]
[2023-08-11 18:07:10] ## OVH ## END - 2023-08-11 18:07:10.969840 exitcode: 255
Go further
Configuring the .ovhconfig file of your Web Hosting plan
Using SSH on a Web Hosting plan
For specialised services (SEO, development, etc.), contact OVHcloud partners.
If you would like assistance using and configuring your OVHcloud solutions, please refer to our support offers.
Join our community of users.

