I have a cron job setup, with the minimum value of 60 seconds, and I want the program to be able to run at second intervals i.e. whatever I set it as 60 seconds onwards.
So for example, I want the cron job to run every 65 seconds, or every 63 seconds, or every 160 seconds etc.
Is this possible? Or is cron job only set to run at 60 second intervals?
If yes, what would the cron job for this look like?
I managed to make it run every 'x' minutes: So far, I have managed to use a database value which the user inserts to run the cron job every set number of minutes. Which looks like this:
cron.schedule('*/' + test + ' * * * *', function () {
console.log('running a task every minute');
});
With the schema looking like:
var CronSchema = new mongoose.Schema({
minutes: { type: Number, min: 1 }
})
How can I run a cron job every 'x' seconds? Ideally, I would only allow a user to input a value in seconds, so if they want the job to run every two minutes they would have to input 120 seconds.