user7017426
user7017426

Reputation:

How to create crontab to run every one minute using linux command?


I have the perl file named as perl.pl. I want this file to run and output the contents in new file using crontabs?

I dont know the steps how to perform it?Can anyone explain me with screenshots

Upvotes: 0

Views: 368

Answers (2)

Shippy
Shippy

Reputation: 425

You will need to open crontab by using:

crontab -e

This will open crontab in a text editor (usually this is vi or vim). Once inside the editor you will want to add:

* * * * * /usr/bin/perl <PATH_TO_DIR>/perl.pl

This will run perl.pl once every minute. The five asterisks mean that the script will run every minute, every hour, every day of month, every month and every day of the week.

For more information on how crontab works read over some of the examples on this page.

Upvotes: 1

Vishal Kotcherlakota
Vishal Kotcherlakota

Reputation: 1154

I'd suggest a search before asking a question like this: https://stackoverflow.com/a/5398044/225905. TL;DR using all * for hour, month, day, and year will give you crontab once a minute. For example:

* * * * * /path/to/php /var/www/html/a.php

Once a minute is quite frequent for cron, and cron won't repeat any faster than that. It may be better to have your perl script run in the background and repeat its calculation once a minute.

Upvotes: 0

Related Questions