Run job every 1.5 hours (90 minutes)

2,971 views
Skip to first unread message

damir.ga...@gmail.com

unread,
Dec 11, 2014, 3:08:19 AM12/11/14
to whenev...@googlegroups.com
Hello.

Is there a way to run a cron job every 1.5 hours?

Thanks!

Javan Makhmali

unread,
Dec 11, 2014, 11:04:29 AM12/11/14
to whenev...@googlegroups.com
It's possible by first building up an array of times spaced by 90 minutes.

every_90_minutes = (24 * 60 / 90).times.map { |i| Date.today.to_time + (90 * 60) * i }

every 1.day, at: every_90_minutes do
  command "every-90-minutes"
end

The result will be two cron jobs to accommodate  all the times:

$ whenever

0 0,3,6,9,12,15,18,21 * * * /bin/bash -l -c 'every-90-minutes'

30 1,4,7,10,13,16,19,22 * * * /bin/bash -l -c 'every-90-minutes'

--
--
You received this message because you are subscribed to the Google
Groups "Whenever Gem" group and because you're awesome.
To post to this group, send email to whenev...@googlegroups.com
To unsubscribe from this group, send email to
whenever-gem...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/whenever-gem?hl=en
---
You received this message because you are subscribed to the Google Groups "Whenever Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email to whenever-gem...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages