Setup a cron job that runs on every 15 minute using Crontab in Ubuntu 16.04

In a Ubuntu-powered VPS, there was requirement to run a PHP script on every 15 minute. So, I fire up Google, search in ubuntu-related resources and setup it a crob job that run on every 15 minutes. This article is a ready-reference for me and, of course, for the rest of the world who runs into similar scenario.

I used Crontab and below is the command that is still serving my purpose:

*/15 * * * * /usr/bin/php /your/path/to_the_folder_of/php_script/your-script-filename.php

 

Code Dissection

  1. */15 - tell Ubuntu to run the script on EVERY 15 MINUTE
  2. * - 2nd asterisk tells OS to run on EVERY HOUR
  3. * - 3rd asterisk tells OS to run on EVERY DAY
  4. * - 4th asterisk tells OS to run on EVERY MONTH
  5. * - 5th asterisk tells OS to run on EVERY DAY OF THE WEEK
  6. /usr/bin/php - indicates that PHP is running from "/usr/bin/php" folder
  7. /your/path/to_the_folder_of/php_script/your-script-filename.php - tells the OS about the actual path of your PHP script.

 

Helpful resources

To help you learn about more variant of possible setup on crontab, I have compiled some useful resources on this topic below.

 

I hope that this article will give you a head start and guide you to setup your first crob job in your Ubuntu server.

Other articles of this category:

There is no article found in this category.

I Recommend RamNode VPS Hosting

high performance ssd vps