Cronjob instructs the server to run a specific .php file as per specific intervals directed by the user. Cronjobs is the feature of cPanel which runs a specific php file on a command like once a day, every hour, every minute, every second etc…You will find there several commands you can choose to take action on that particular php file on a specific time..

This feature is very useful to those who wants to schedule tasks, send bulk mails, makes update on regular intervals…

How does a cronjob work?

Now suppose I have a webapp which makes temporary xml files when user logs-in and stores their activity till they are online. When the leave the webapp, or remain inactive for about a hour, I want to delete them. So, how to i instruct my server to delete them ? How do I tell my server “Go Delete All Messages every 1 hour“?

In this case, I make a php script which deletes those files when run. Then I setup a cronjob to run that php file every 1 hour/60 minutes/3600 seconds automatically.

Here are some Easy steps to Set up cronjobs in cPanel:

step::1 Login to cPanel
step::2 Scroll down to Advance section
step::3 Click on Cron jobs to open
There are several more commands which i would like to show you..
step::4 Add your Cron Jobs
step::5 That’s it!!!

Domain-specific example:
/usr/local/bin/ea-php56 /home/username/domain_path/path/to/cron/script

In the above example, replace “ea-php56” with the PHP version assigned to the domain you wish to use. Look in the MultiPHP Manager for the actual PHP version assigned to a domain. Hope this helps you!!!

0 Shares:
You May Also Like
Read More

Looking at AWS Amplify

AWS Amplify is a collection of tools from AWS to help you build applications. Allow me to set…