HOW TO CREATE A CRONJOB IN CPANEL
- Log in to your cPanel account provided by your hosting provider.
- Look for the “Advanced” or “Advanced Features” section in cPanel.
- Locate and click on the “Cron Jobs” option. This will open the Cron Jobs interface.
- In the Cron Jobs interface, you will see different fields and options to configure your cron job.
- Choose the interval at which you want your cron job to run. You can select common intervals like “Once Per Minute,” “Once Per Hour,” or set a custom interval.
- Enter the command you want to run in the “Command” field. This command specifies the task you want the cron job to execute. For example:
- To run a PHP script:
/usr/bin/php /home/username/public_html/script.php
- To run a Python script:
/usr/bin/python /home/username/public_html/script.py
- To run a shell script:
/bin/sh /home/username/public_html/script.sh
- To run a PHP script:
- Optionally, you can add email notifications for the cron job output. Enter your email address in the “Email” field to receive notifications or leave it blank to disable email notifications.
- Click on the “Add New Cron Job” or “Create” button to save and schedule the cron job.
- You will see a confirmation message indicating that the cron job has been successfully created.
Note: Make sure to replace “username” with your actual cPanel username and adjust the file paths accordingly.