Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cron implementation in Erlang

Tags:

cron

erlang

timer

I need to provide a way to perform actions at specific date/time repeatedly. Basically it should work like Cron and I'm thinking of the way of managing execution times.

One solution could be to run a loop in each job/process and constantly check (every minute or second) whether current time is the time we are waiting for.

Another solution could be to work with timers by waiting until the next execution. We calculate the difference between now and the next execution time, and supply that delay to the timer. But since the execution times should be manageable, we would need to have a way to interrupt that timer and create a new one, or we could simply kill that process and create a fresh one.

Does anyone have any thoughts on how it should be done properly, or are they any libraries for accomplishing this particular scenario?

like image 909
rpozarickij Avatar asked Aug 21 '14 06:08

rpozarickij


1 Answers

Here are 4 libs you could take a look at:

https://github.com/erlware/erlcron

https://github.com/b3rnie/crontab

https://github.com/jeraymond/leader_cron

https://github.com/zhongwencool/ecron

like image 166
David Wickstrom Avatar answered Oct 21 '22 14:10

David Wickstrom