1846877 Members
4088 Online
110256 Solutions
New Discussion

crontab

 
SOLVED
Go to solution
Amit Dixit_2
Regular Advisor

crontab

Hi,
want to make entry in crontab so as to execute a command after every two minutes.

thanks
amit
8 REPLIES 8
Slawomir Gora
Honored Contributor

Re: crontab

Hi,

on linux works:

*/2 * * * * command
Slawomir Gora
Honored Contributor
Solution

Re: crontab

Hi,

in hpux */1 doesn't work
I think you have to do:

0,2,4,6,8,10,12,14,16 .... 58 * * * * command
Eric Antunes
Honored Contributor

Re: crontab

Hi amit,

#cd /usr/spool/cron/crontabs
#vi root.tmp (if you want to run this command as root. If you want to run it with another user: vi .tmp)

...add the following line...

2,4,6,8,10,...,58 * * * * /.../command.sh

...save the file...

#crontab root.tmp

Best regards,

Eric Antunes
Process Management->Scheduled Cron Jobs->Actions->Add.
Each and every day is a good day to learn.
Julián Esteban Aimar
Occasional Advisor

Re: crontab

$crontab -e
vi insert mode, and write
0 2 4 6 8 .... 58 * * * *

sorry, my english is poor.

Julian from Argentina.
Julián Esteban Aimar
Occasional Advisor

Re: crontab

THIS IS CORRECT !!!!

$crontab -e
vi insert mode, and write
0,2,4,6,8, .... ,58 * * * *

sorry, my english is poor.

Julian from Argentina.
Prashant Zanwar_4
Respected Contributor

Re: crontab

crontab -e >> /tmp/cronfile1

Make the necessary changes to /tmp/cronfile1
whereever you feel comfortable

0 2 4 6 8 .... 58 * * * *

DO crontab /tmp/cronfile, this will write a new root cron file for you.
This is what I have used to make changes.

Thanks
Prashant

"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Siddhesh
Advisor

Re: crontab

Amit,

I would prefer to prepare a script with "sleep 120".

Siddhesh.
Prashant Zanwar_4
Respected Contributor

Re: crontab

Sorry,
After you make necessary changes to /tmp/cronfile1

do

crontab /tmp/cronfile1

Please note the change it's cronfile1 to do corntab on.

Thanks
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."