Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Konstantin Nikiforov
committed
Oct 19, 2011
1 parent
3a57d0c
commit 72ae405
Showing
4 changed files
with
38 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%% To call io:format("~p", [context@]) every 10 seconds all day | ||
example1(Context) -> | ||
JobId = <<"my job #1">>, | ||
When = {daily, {every,{5,sec},{between,{0,am},{11,59,pm}}}}, | ||
Task = cron_task:new(When, io, format, ["~p", [context@]]), | ||
{ok, _} = z_notifier:first({cron_job_insert, JobId, Task}). | ||
|
||
|
||
%% Parse MFA from string. Start *temporarily* job. Job will be dropped on stop. | ||
example2(ArgsString, Context) -> | ||
JobId = <<"my other job">>, | ||
When = {weekly, wed, {2, am}}, | ||
Args = cron_task:parse_args(ArgsString), | ||
Task = cron_task:new(When, io, format, Args), | ||
{ok,_} = z_notifier:first({cron_job_start, JobId, Task}). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters