Linux provides the cron job for the jobs, tasks, or processes which should be run at the specified intervals. A cron job can be configured for different intervals like daily, weekly, every two days at the specified time, etc. One of the most used intervals is running a job every minute.
Run Cron Job In Every Minute
The cron jobs are stored in a file named /etc/crontab file. This crontab file contains some jobs by default. These preexisting jobs run in different intervals. The format of the crontab file is like below.
cat /etc/crontab
To add a new job that runs in every minute the crontab command can be used. The -e option is provided to edit crontab file with the current user privileges.
crontab -e
Now we will set the crontab configuration. In this example we will run the touch command to create a file in the “/tmp/test”.
* * * * touch /tmp/test
Run Script Every Minute
Also a script can be executed in every minute by using the cron job. The process is the same where the crontab file is opened with the following command.
crontab -e
The script is named as “backup.sh” and located under the /home/ismail/.
* * * * /home/ismail/backup.sh