%%----------------------------------------------------------------------------- %% %% the cron tab running in erlang %% %% please see also crontab(5) : man 5 crontab %% %% field allowed values %% ----- -------------- %% minute(m) 0-59 %% hour(h) 0-23 %% day of month(dom) 1-31 %% month(mon) 1-12 %% day of week(dow) 0-7 (0 or 7 is Sun) %% server open day 0-infinity 服务器开服天数(缺省值为任意天数) %% %% Format: %% %% {{m, h, dom, mon, dow}, {M, F, A}}. %% M:F(A) is excuted in a new erlang process %% %% {{m, h, dom, mon, dow, dos}, {M, F, A}}. %% M:F(A) is excuted in a new erlang process %% %% Some exampls: %% %% {{"0", "2", "*", "*", "*"}, {io, format, ["hello~n"]}}. %% print "hello" in hour 2 ervery day %% %% {{"0-59/2", "*", "*", "*", "*"}, {erlang, garbage, [whereis(user)]}}. %% do the garbage collect on user process, every 2 minitues(0, 2, ..., 58) %% %% {{1-59/15, "0-12/2,12-23/1", "*", "*", "*"}, {io, format, ["crontab!~n"]}}. %% print "crontab!", every 2 hours between 0 and 12, every 1 hour between 12 and 23 %% %%----------------------------------------------------------------------------- %% demo, say hello ervery minitues %%{{"*", "*", "*", "*", "*"}, {io, format, ["^_^ hello by crontab\n"]}}. %%---------------------------------------------------------------------- %% 每分钟触发时间 %% 示例 %% {{"0-59/1", "*", "*", "*", "*"}, {Module, Fun, Args}}. %%---------------------------------------------------------------------- {{"0-59/1", "*", "*", "*", "*"}, {role_gs, cast_online, [{on_minute_refresh}]}}. {{"0-59/1", "*", "*", "*", "*"}, {ms_process, cast, [activity_schedule_gs, {on_minute_refresh}]}}. {{"0-59/1", "*", "*", "*", "*"}, {ms_process, cast, [behavior_tree_gs, on_minute_refresh]}}. %%---------------------------------------------------------------------- %% 每一小时触发事件 %% 示例 %% {{"0", "0-23/1", "*", "*", "*"}, {Module, Fun, Args}}. %%---------------------------------------------------------------------- {{"0", "0-23/1", "*", "*", "*"}, {role_gs, cast_online, [{on_hour_refresh}]}}. %%---------------------------------------------------------------------- %% 每天0点触发事件 %% 示例 %% {{"0", "0", "*", "*", "*"}, {Module, Fun, Args}}. %%---------------------------------------------------------------------- {{"0", "0", "*", "*", "*"}, {role_gs, cast_online, [{on_day_refresh}]}}. {{"0", "0", "*", "*", "*"}, {ms_process, cast, [activity_daily_hosting_gs, {on_day_refresh}]}}. {{"0", "0", "*", "*", "*"}, {rank_gs, cast_all, [on_day_refresh]}}. {{"0", "0", "*", "*", "*"}, {role_mgr_gs, on_new_day, []}}. %%---------------------------------------------------------------------- %% 每周一0点触发事件 %% 示例 %% {{"0", "5", "*", "*", "1"}, {Module, Fun, Args}}. %%---------------------------------------------------------------------- {{"0", "0", "*", "*", 1}, {role_gs, cast_online, [{on_week_refresh}]}}. {{"0", "0", "*", "*", 1}, {rank_gs, cast_all, [on_week_refresh]}}. %%---------------------------------------------------------------------- %% %每月1日0时触发事件 %% 示例 %% {{"0", "0", "1", "*", "*"}, {Module, Fun, Args}}. %%-------------------------------------------------------------------- {{"0", "0", "1", "*", "*"}, {role_gs, cast_online, [{on_month_refresh}]}}. {{"0", "0", "1", "*", "*"}, {rank_gs, cast_all, [on_month_refresh]}}.