# crontab-node

> help crontab

Latest version **3.0.1** (published 2019-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install crontab-node
pnpm add crontab-node
yarn add crontab-node
bun add crontab-node
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2019-11-12 |
| First published | 2018-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 78.9 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | luoage@msn.cn |
| Maintainers | luoage |
| Keywords | crontab, node |

## Links

- npm: https://www.npmjs.com/package/crontab-node
- Repository: https://github.com/luoage/crontab-node
- Homepage: https://github.com/luoage/crontab-node#readme
- Issues: https://github.com/luoage/crontab-node/issues
- npm.io page: https://npm.io/package/crontab-node

## Dependencies (2)

- [moment](https://npm.io/package/moment.md) 2.22.2
- [cron-parser](https://npm.io/package/cron-parser.md) 2.6.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 3.0.1 (latest) — 2019-11-12
- 2.0.5 — 2019-11-08
- 2.0.4 — 2019-06-29
- 2.0.3 — 2019-06-29
- 2.0.2 — 2019-06-09
- 2.0.1 — 2019-06-09
- 2.0.0 — 2019-06-09
- 1.3.0 — 2018-11-23
- 1.2.0 — 2018-11-23
- 1.1.1 — 2018-10-26
- 1.1.0 — 2018-10-26
- 1.0.0 — 2018-10-16

## README

# crontab-node

```
yarn add crontab-node
```

crontab-node目的是配合linux的crontab使用, 需要每分钟执行一次，时间触发后才会执行函数方法

![kernel](./example.png)

## Example

c.js

```
const crontab = require('crontab-node');
const eventEmitter = require('crontab-node/eventEmitter');

eventEmitter.on('crontab-node exit', () => {
	process.exit(0);
});
const promise = new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve();
    }, 1);
});

console.log(new Date());

crontab('*/2 * * * *', () => {
	return promise.then(() => {
		console.log('I am callback, just excute once');
	});
});

```

crontab -l

```
* * * * * node path/c.js
```

---
_Source: https://npm.io/package/crontab-node · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
