Skip to content

Instantly share code, notes, and snippets.

@bobwei
Created July 13, 2017 11:12
Show Gist options
  • Save bobwei/839a49e6837da57f95b6b90b626e0cee to your computer and use it in GitHub Desktop.
Save bobwei/839a49e6837da57f95b6b90b626e0cee to your computer and use it in GitHub Desktop.
import 'dotenv/config';
import { CronJob } from 'cron';
const { JOB1_CRON_TIME } = process.env;
new CronJob({
cronTime: JOB1_CRON_TIME,
onTick: () => {
console.log('do your job');
},
start: true,
runOnInit: true,
timeZone: 'UTC',
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment