Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Run Cron Job every 2 minutes interval

1,937 views
Skip to first unread message

Prachet

unread,
Nov 14, 2008, 3:25:17 PM11/14/08
to prachet...@gmail.com
Hi All

I want my cron job to run at every 2 minutes interval in all hours,
days, months etc.
OS - Sun Solaris
Release Level -5.10

I tried with */2 * * * * filename but it failed.

How to do that?

Regards
Prachet

Chris Ridd

unread,
Nov 14, 2008, 3:36:07 PM11/14/08
to

Try 'man crontab' on your Solaris box to find out the format of each field.

--
Chris

ThanksButNo

unread,
Nov 14, 2008, 4:53:37 PM11/14/08
to

Try this -- all on one line --

0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,49,50,52,54,56,58


* * * * filename

Sure, it looks inelegant, but elegance costs extra. Remember, my
advice is worth every penny you paid for it!

Alternatively, use "at" instead of "cron". Set up a script:

#!/bin/sh
# Script named "myScript"
at now + 2 minutes <<!
/pathTo/myScript
!
.... perform my script functions ...
#end myScript

Hope that's helpful.

Message has been deleted
Message has been deleted

u2c...@gmail.com

unread,
Nov 16, 2008, 9:02:42 AM11/16/08
to
#!/bin/sh
# Script named "myScript"
at now + 2 minutes <<!
/pathTo/myScript
!
.... perform my script functions ...
#end myScript

Threr is a mistake or limitation in above method, you don't calculate
the time which "myscript" run.
You can add a "&" after "/pathTo/myScript"

On Nov 15, 5:45 pm, Huge <H...@nowhere.much.invalid> wrote:


> On 2008-11-14, ThanksButNo <no.no.tha...@gmail.com> wrote:
>
>
>
> > On Nov 14, 12:25 pm, Prachet <prachetmoha...@gmail.com> wrote:
> >> Hi All
>
> >> I want my cron job to run at every 2 minutes interval in all hours,
> >> days, months etc.
> >> OS - Sun Solaris
> >> Release Level -5.10
>
> >> I tried with */2 * * * * filename but it failed.
>
> >> How to do that?
>
> >> Regards
> >> Prachet
>
> > Try this -- all on one line --
>
> > 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,49,50,52,54,56,58
> > * * * * filename
>

> 49?    :o)


>
> > Sure, it looks inelegant, but elegance costs extra.  Remember, my
> > advice is worth every penny you paid for it!
>
> > Alternatively, use "at" instead of "cron".  Set up a script:
>
> > #!/bin/sh
> > # Script named "myScript"
> > at now + 2  minutes <<!
> > /pathTo/myScript
> > !
> > .... perform my script functions ...
> > #end myScript
>

> Alternatively, have the script that's run check to see if it's an even minute,
> and otherwise exit.
>
> --
>    "I have never been able to conceive how any rational being could propose
> happiness to himself from the exercise of power over others." - Thomas Jefferson
>                [email me at huge {at} huge (dot) org <dot> uk]

Cydrome Leader

unread,
Nov 18, 2008, 11:37:30 AM11/18/08
to
Michael Vilain <vil...@nospamcop.net> wrote:
> In article
> <45c7e182-b9d6-4834...@40g2000prx.googlegroups.com>,
> This is Linux syntax for crontab. Solaris' crontab syntax is available
> under it's man page.

It's Vixie Cron syntax if you want to be accurate.

Thomas Schulz

unread,
Nov 18, 2008, 1:44:23 PM11/18/08
to
>Alternatively, use "at" instead of "cron". Set up a script:
>
>#!/bin/sh
># Script named "myScript"
>at now + 2 minutes <<!
>/pathTo/myScript
>!
>.... perform my script functions ...
>#end myScript
>
>Hope that's helpful.

Shades of VAX/VMS batch. It works, but if anything goes wrong so as to
prevent the resubmission you loose your job.
--
Tom Schulz
sch...@adi.com

0 new messages