forked from tozny/docker-pgdump-s3
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (18 loc) · 706 Bytes
/
index.js
File metadata and controls
25 lines (18 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// entrypoint for execution
var CronJob = require('cron').CronJob;
const handler = require('./lib/handler')
module.exports.handler = handler
// remove quotes around cron schedule
var cronSchedule = process.env.CRON_SCHEDULE.replace(/["']+/g, '')
console.log("Starting backup service on cron schedule: " + cronSchedule)
const job = new CronJob(cronSchedule, function(){
console.log('Running cron task at ' + new Date())
// run the backup script
handler(null, null, function(){})
}, null, true, 'America/Los_Angeles')
process.on('SIGINT', function(){
job.stop()
process.exit(0)
})
// run without event or context for execution outside of lambda environment
//handler(null,null,function(){})