*/5 not working in AIX

Hi Guys,

I tried to schedule a script for every 5 mins. i tried */5 but it is not working.

Is writing every 5 mins is the only way to do it?

like below

05,10,15,20,25,30,35,40,45,50,55 05-08

Thanks And Regards,
Magesh

You have an another way also.,

0-59/5

Which also means every five minutes.

I even tried that, It was also giving me an error.

Actually i want to schedule a script to run from 4 30 - 8 30 for every 5 minutes..

Thanks..

Can you please post the error.

Along with the distribution of linux you use, and crontab version.

Actually am using AIX.

uname -a
AIX cli002fcrd02 3 5 00C4B9FC4C00

This is the error it gives.

A line of the crontab file:
        */5 05 * * 1-5 /trigger.ksh > trigger.log

contains the following error:
        0481-079 Reached a symbol that is not expected.

Yep, in AIX you have to mention it in long format.

As far as i searched, i did not find any easy way to input something like */5.. I think somebody else can provide a better solution.

But i want to run it from 4 30 am to 8 30.. only..
how to do it in the long form?
Can you help me

You could either

  • write a wrapper script which only calls your actual script when your time criterium is met
    or
  • use 3 crontab entries: from 4 30 to 4 55, from 5 00 to 7 55 and from 8 00 to 8 30
30,35,...,50,55 4 * * * # 4:30 - 4:55
00,05,...,50,55 5-7 * * * # 5:00 - 7:55
00,05,...,25,30 8 * * * # 8:00 - 8:30

Thanks man.. so it cant be done in a single cron entry.. cannot we write a if clause in the cron entry??

We can. Thats more or less my wrapper script approach (without the script).

can you explain the wrapper script.. i did not understand that..

not exactly pretty but it should work.

30,35,40,45,50,55 4 * * * /your/job/foo.ksh
0,5,10,15,20,25,30,35,40,45,50,55 5 * * * /your/job/foo.ksh
0,5,10,15,20,25,30,35,40,45,50,55 6 * * * /your/job/foo.ksh
0,5,10,15,20,25,30,35,40,45,50,55 7 * * * /your/job/foo.ksh
0,5,10,15,20,25,30 8 * * * /your/job/foo.ksh

or what cero suggested.

30,35,40,45,50,55 4 * * * /your/job/foo.ksh
0,5,10,15,20,25,30,35,40,45,50,55 5-7 * * * /your/job/foo.ksh
0,5,10,15,20,25,30 8 * * * /your/job/foo.ksh