In this article, we will explain step-by-step how to add Cron Jobs in cPanel.
First, let’s define what Cron Jobs are.
Cron Jobs are an automation tool in cPanel. They allow you to automate commands that will run at specific intervals on your website. This can include tasks such as backing up your website or checking for updates. For example, if you want to back up a file every six hours, you can do this using cPanel's Cron Jobs feature.
To Create a Cron Job in cPanel:
1- Log in to the Customer Control Panel:
Log in to your Atak Domain customer control panel.
2- Select Your Hosting Account:
Click the "My Hostings" button in the Atak Domain Customer Control Panel.
Click the Manage button next to your hosting service.
3- Access cPanel:
On the "Hosting Management" page, click the Go to Control Panel button to access cPanel.
4- Click on Cron Jobs:
Under the Advanced section, click on the Cron Jobs icon.
5- Set Email for Notifications:
You can enter an email address to receive notifications when your Cron jobs run. (In this example, the address used is [email protected])
6- Add a Cron Job:
You can simplify the setup by selecting a frequency from the Common Settings dropdown. It offers predefined schedules for running jobs (every minute, hourly, monthly, etc.).
Common Settings: Offers commonly used intervals. Selecting one will automatically populate the minute, hour, day, month, and weekday fields.
Minute: Minute setting for the cron job
Hour: Hour setting for the cron job
Day: Day setting for the cron job
Month: Month setting for the cron job
Weekday: Weekday setting for the cron job
Command: The command to be executed by the cron job
1- Let's say you want to fetch the USD exchange rate from the Central Bank. You have a file named kur_guncelle.php
uploaded under public_html
.
File Path:
/home/username/public_html/kur_guncelle.php
2- Prepare the command to enter in the “Command” field.
Common Settings:
Runs every day at midnight (00:00).
Your Command:
/usr/local/bin/php /home/username/public_html/kur_guncelle.php
Note: Replace username
with your actual cPanel username. (In the example, it was acc368atakdomai
.)
Click the Add New Cron Job button to save the job.
Congratulations! Your cron job has been added. In this section, you can create, edit, or delete Cron jobs.