Skip to content

Instantly share code, notes, and snippets.

@lakshaygupta21
Created June 19, 2020 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lakshaygupta21/e0c5871de746d237f24c6c2e8309ab85 to your computer and use it in GitHub Desktop.
Save lakshaygupta21/e0c5871de746d237f24c6c2e8309ab85 to your computer and use it in GitHub Desktop.
let cron = require('node-cron')
let shell = require('shelljs')
var express = require('express')
var app = express()
app.get('/', function(req, res) {
res.redirect("https://www.youtube.com/watch?v=wYOA4waoWog")
})
cron.schedule("8 17,25,34,42,51,59 * * * *", function() {
console.log('scheduler running...')
if (shell.exec('node server.js').code !== 0) {
console.log('Something went wrong ')
}
})
app.listen(process.env.PORT || 3000, () => console.log(`Server started on port 3000`));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment