Configurable job scheduler through well know file formats
To run Trampo you will just need to have Nodejs (at least version 8) and NPM installed on your local machine.
You can install Trampo on your global scope:
npm i -g trampo
Or you can run it directly using npx:
npx trampo -F /path/to/config.json
Trampo uses JSON files to run the jobs. For now, it has support for 2 kinds of jobs: OneTimeJob and CronJob. They have very similar config files, the only thing that differentiates them, is that one-time job uses the when parameter and the cron job uses the period parameter.
There are 2 things that Trampo can run on the jobs scheduled. It can make an HTTP request or execute a command on your system.
HTTP Request:
{
url: string;
method: HttpMethod;
headers?: object;
body?: unknown;
params?: object;
}
Exec:
{
exec: string;
}
{
"when": 10000,
"exec": "echo \"Hello World\" >> test.txt ",
"name": "One time job"
}
{
"name": "Cron job",
"httpRequest": {
"url": "http://localhost:3000/home",
"method": "get",
"params": {
"hello": "world"
}
},
"period": "* * * * *"
}
The final JSON config file that Trampo uses should have a CronJob or a OneTimeJOb or both, wrapped in an array:
[
{
"when": 10000,
"exec": "echo \"Hello World\" >> test.txt ",
"name": "One time job"
},
{
"name": "Cron job",
"httpRequest": {
"url": "http://localhost:3000/home",
"method": "get",
"params": {
"hello": "world"
}
},
"period": "* * * * *"
}
]
To run the jobs using Trampo is easy like that, you build your JSON config file like explained above, they run passing it as the argument:
trampo -F /path/to/config.json
or
trampo --file /path/to/config.json
Normal tests:
npm run test
Tests with file watch:
npm run test:tdd
Coverage test
npm run test:coverage
npm run build
- Typescript
- Webpack
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Pedro Mutter - Initial work - MutterPedro
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details