https://github.com/yuis-ice/node-cron-cli
Command Line Implementation for Node Cron Under 20 Lines.
https://github.com/yuis-ice/node-cron-cli
cli cli-app command-line cron nodejs
Last synced: about 1 year ago
JSON representation
Command Line Implementation for Node Cron Under 20 Lines.
- Host: GitHub
- URL: https://github.com/yuis-ice/node-cron-cli
- Owner: yuis-ice
- License: bsd-3-clause
- Created: 2021-01-17T15:58:08.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-16T10:53:04.000Z (almost 5 years ago)
- Last Synced: 2025-03-25T09:47:28.555Z (over 1 year ago)
- Topics: cli, cli-app, command-line, cron, nodejs
- Language: JavaScript
- Homepage: https://yuis-programming.com/nodecroncli-app
- Size: 7.81 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Node Cron CLI
Command Line Implementation for Node Cron Under 20 Lines.
## Quick Start
This will execute your specified command `pwd` each 2 seconds.
```
$ croncli -p "*/2 * * * * *" -e "pwd" --log
```
The output be like:
```
Jobs started...
[*/2 * * * * *] Job fired: 05/12/2021, 08:42:28 PM GMT+9
/home/ubuntu
[*/2 * * * * *] Job fired: 05/12/2021, 08:42:30 PM GMT+9
/home/ubuntu
[*/2 * * * * *] Job fired: 05/12/2021, 08:42:32 PM GMT+9
/home/ubuntu
```
## Installation
```
npm i --global node-cron-cli
```
## Examples
Every hour
```
0 0 * * * *
```
Every day
```
0 0 0 * * *
```
Every 4 hours
```
0 0 */4 * * *
```
Every day at 11am and 11pm
```
0 0 11,23 * * *
```
For more info, see [kelektiv/node-cron](https://github.com/kelektiv/node-cron)
## Command line options
```
$ ./cron-cli.js
Usage: cron-cli [options]
Options:
-p, --pattern cron pattern (default: "*/5 * * * * *")
-t, --timezone timezone (default: "Asia/Tokyo")
-e, --execute command to be executed (default: "echo Hi.")
-l, --log enable console log
-h, --help display help for command
```
## LICENSE
This software is released under the BSD-3-Clause license.