1834915 Members
2792 Online
110071 Solutions
New Discussion

Simple crontab.

 
SOLVED
Go to solution
Jeff Martin_3
Advisor

Simple crontab.

How do I schedule a job to run every minute of every hour of every day?

Is it ?

* * * * * /runcommand
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: Simple crontab.

Hi Jeff:

The fields of a 'ctontab' entry are:

minute hour monthday month weekday command

Hence, to run 'mycommand' every minute of every hour of every day, do:

* * * * * mything

See the man pages for 'crontab' for more information.

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor
Solution

Re: Simple crontab.

Hi Jeff:

The fields of a 'ctontab' entry are:

minute hour monthday month weekday command

Hence, to run 'mycommand' every minute of every hour of every day, do:

* * * * * mything

See the man pages for 'crontab' for more information.

Regards!

...JRF...
Umapathy S
Honored Contributor

Re: Simple crontab.

hi Jeff,

* * * * * /runcommand

Will do the work.

HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Jim Mallett
Honored Contributor

Re: Simple crontab.

Yes, that syntax is right.

The entries in a crontab file are lines of six fields each. The fields are separated by spaces or tabs. The lines have the following format:
minute hour monthday month weekday command
* * * * * /command

See: man crontab for more.

Hindsight is 20/20
Jose Mosquera
Honored Contributor

Re: Simple crontab.

yeap!

Remember include in /var/adm/cron/cron.allow file the user that must start this job!

Rgds.
Bill Hassell
Honored Contributor

Re: Simple crontab.

Since the job is running every minute, there may be a possibility that your job may run longer than 1 minute, so be sure the job won't get confused when older copies are still running. If this job could ever get hung up (for instance, bdf might hang with a bad NFS server), you could easily get hundreds of processes taking up process slots and create a problem when nproc is exceeded. Since no one is there to make sure things run correctly every minute, add code to your job to use timeouts or other tests.


Bill Hassell, sysadmin