momo
v0.0.130
Published
Cronjob with web hooks.
Downloads
3
Readme
Momo
Cronjob to web hooks.
About
Momo was designed to work as a worker (continuous process), and call it hooks when cron job should be executed. Also Momo DOES NOT USE A DATABASE, it uses remote CSV file to fetch it hook cron list.
Requirements
##Configuration
All Configuration can be done through server.js
file in root directory. (This file is just a sample of a simple server)
Initialization config
option.cronURL
- End point to fetch cronjob list. REQUIREDoptions.cronFetchLoop
- Time interval to Momo fetchoptions.cronURL
in seconds - Default value is:3600000 milliseconds. OPTIONALoptions.momoFPS
- Momo Check Loop (aka.FPS) in milliseconds - Default value is:60000 milliseconds. OPTIONAL
Installation
Start server
$ 'node server.js' OR 'foreman start'
##CronJob Syntax
Momo CronJob syntax is very near to the Unix cron syntax, BUT it'll not allow ?
character ,words and special keywords. (the last 2, are on roadmap.)
###Style * * * * * url_to_be_called ┬ ┬ ┬ ┬ ┬ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └───── day of week (0 - 6) (0 is Sunday) │ │ │ └────────── month (1 - 12) │ │ └─────────────── day of month (1 - 31) │ └──────────────────── hour (0 - 23) └───────────────────────── min (0 - 59)
source Wikipedia - but modified
Special Keywords
Keyword | Equivalent | Description
------------- | ------------- | -------------
@yearly
OR @annually
| 0 0 1 1 *
| Run one time a year, on midnight, January 1.
@monthly
| 0 0 1 * *
| Run one time a month, on midnight, first day of month.
@weekly
| 0 0 * * 0
| Run once a week, on midnight, on Sunday.
@daily
| 0 0 * * *
| Run once a day, on midnight.
@hourly
| 0 * * * *
| Run once a hour, on initial minute of it.
###Syntax Rules
*
- Means deactivated OR if not alone, means anything.1
(or any number) - Only this number will match.1,9
OR1,2,3
- Any of these will match.1-3
- Range (same as1,2,3
).1,3-5
- Range and individual (same as1,3,4,5
).
All these commands can be combined with two stage command using the character /
.
###Samples
* * * * * http://example.com
- Deactivated cronjob@monthly http://example.com
- Will run each month.*/* * * * * http://example.com
- Will run each 1 minute.* */* * * * http://example.com
- Will run each 1 minute.2/* * * * * http://example.com
- Will run every 2 minutes ,checking each minute.6/2 * * * * http://example.com
- Will run every 12 minutes in one hour.6,2/2 * * * * http://example.com
- Will run every 12 and 4 minutes.2-4/* * * * * http://example.com
- Will run every 2,3,4 minutes. (Will not call two times if have an collision, as this sample)*/5 * * * * http://example.com
- Will run on any minute divisible 5.*/7,9 * * * * http://example.com
- Will run each on minutes0
,7
,9
,14
,18
and any others divisible by 7 or 9 until 59, that is the minutes limit.*/7-9 * * * * http://example.com
- Will run each on minutes0
,7
,8
,9
and any others divisible by 7,8, or 9 until 59, that is the minutes limit.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request