DEV Community

Gurpinder Singh
Gurpinder Singh

Posted on

Set cron job in cpanel

Setting up a cron job in cPanel is relatively straightforward. Here's a step-by-step guide:

How to set a cron job by using the terminal in Ubuntu Server

Log in to cPanel:
Go to your cPanel dashboard. You should have received login credentials from your hosting provider.

Locate the Cron Jobs Icon:
In cPanel, search for the "Cron Jobs" icon. It's usually located in the "Advanced" or "Metrics" section, depending on your cPanel theme.

Access the Cron Jobs Page:
Click on the "Cron Jobs" icon to access the Cron Jobs page.

Choose Cron Job Settings:
On the Cron Jobs page, you'll see options to set up cron jobs. You can select from common settings like "Common Settings," "Minute," "Hour," "Day," "Month," and "Weekday."

Enter the Command:
In the "Command" field, enter the command you want the cron job to execute. This could be a PHP script, a shell script, or any other executable command. Make sure the command is correct and complete.

Set the Schedule:
Choose the schedule for your cron job using the "Common Settings" or specify the exact timing using the "Minute," "Hour," "Day," "Month," and "Weekday" fields.

Save the Cron Job:
Once you've entered the command and set the schedule, click on the "Add New Cron Job" or "Add Cron Job" button to save your cron job.

Verify the Cron Job:
After saving, you should see a confirmation message indicating that the cron job has been added successfully. You may also see a list of existing cron jobs on the Cron Jobs page.

Test the Cron Job:
It's a good practice to test your cron job to ensure it's working as expected. You can do this by running the command manually or waiting for the scheduled time to see if it executes.

Monitor and Manage Cron Jobs:
You can monitor and manage your cron jobs from the Cron Jobs page in cPanel. Here, you can edit, delete, or disable cron jobs as needed.

How to send a token with every request using HTTP headers?

Which encryption is used to secure the token key?

How to set a cron job by using the terminal in Ubuntu Server

That's it! You've successfully set up a cron job in cPanel. Make sure to regularly review and update your cron jobs as necessary.

Thanks for reading,
Dgi Host.com

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay