Posted inWeb Technology / linux

How to configure Crontab in Linux?

Crontab (cron table) is a Linux utility that allows you to run commands or scripts automatically at specified intervals. Here’s how you can configure crontab on a Linux system:

  1. Open the terminal and type the following command to open the crontab file for editing:

crontab -e

  1. The crontab file will open in the editor specified by the VISUAL or EDITOR environment variable. If neither is set, it will default to vi.
  2. To add a new cron job, add a new line in the following format:

* * * * * /path/to/command

The first five fields represent the following information:

  • Minute (0-59)
  • Hour (0-23)
  • Day of the month (1-31)
  • Month (1-12)
  • Day of the week (0-7, where both 0 and 7 represent Sunday)

For example, to run a command every day at 3 PM, the line would look like this:

0 15 * * * /path/to/command

  1. Save and close the crontab file.
  2. Verify that the new cron job has been added by using the following command:

crontab -l

This will list all the cron jobs that are currently configured.

Note: When specifying paths in crontab, make sure to use the full absolute path, rather than a relative path.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype