Operating System - HP-UX
1821067 Members
2518 Online
109631 Solutions
New Discussion юеВ

set crontab to run a job every minute.

 
SOLVED
Go to solution
Gino Castoldi_2
Honored Contributor

set crontab to run a job every minute.

Hi,

HP-UX 11.0 L2000

I need to run a single cron job every minute all the time.
How would I set the minutes field in the crontab ?

10 points to any good answer.
Thank you Gino.
8 REPLIES 8
Pete Randall
Outstanding Contributor
Solution

Re: set crontab to run a job every minute.

I think

[1-60] * * * * *

would do it.

Pete

Pete
Armin Feller
Honored Contributor

Re: set crontab to run a job every minute.

# crontab -e
+-----------------------
| * * * * * exec ...
|
|:wq!

Regards,
Armin
RAC_1
Honored Contributor

Re: set crontab to run a job every minute.

crontab -e user_name

* * * * * your_program/script
There is no substitute to HARDWORK
Anthony deRito
Respected Contributor

Re: set crontab to run a job every minute.

A line like this:

* * * * * command

would execute command every minute, regardless of which hour / day / month it is. This should also explain how the first * in '/etc/crontab' works: 'execute the command in the first minute of every hour, on every day, in every month'.

Tony
Patrick Wallek
Honored Contributor

Re: set crontab to run a job every minute.

To run every minute it would be:

* * * * * /script_to_execute

This will tell cron to run for ALL values in all fields.

Or this MAY work as well:

0-59 * * * * /script_to_execute

This would be for minutes 0-59 of every hour of every day.
Steve Steel
Honored Contributor

Re: set crontab to run a job every minute.

Hi

Not 1-60 but 0-59

Each line of CRONTAB has the following structure:



Position: Values:
Minute 0-59
Hour 0-23
Day 1-31
Month 1-12
Day of week 0-6 (0=Sunday, 1=Monday, ..., 6=Saturday)

Instead of minute, hour, day, month or day of week it's also possible to specify a *. A * represents all possible values for that position (e.g. a * on 2nd position is the same as specifying all the possible values for hour)

It's also possible to specify several values separated by commas: e.g. if you want a command to be executed every 10th minute so you can specify 0,10,20,30,40,50 for minute. A range of values can be specified with a -: e.g. value 0-12 for hour -> every hour a.m.


Regards

Steve Steel

Quote of the moment
-------------------
"We are drowning in information but starved for knowledge."
-- John Naisbitt
If you want truly to understand something, try to change it. (Kurt Lewin)
Jose Mosquera
Honored Contributor

Re: set crontab to run a job every minute.

Hi,

Your **Allways** crontab entry must be

* * * * *

Rgds.
Gino Castoldi_2
Honored Contributor

Re: set crontab to run a job every minute.

Hi Everyone,

Thank you for your answers!

Thank you again Gino.