I have my app in node js
and i want them to be executed on its scheduled time
But the problem is in between that if my server crash/stop/restart then those scheduled jobs are not persisted and are not executed.
Also, all my jobs are scheduled and executed using only single process, but i want multiple process to do the job.
I want all my jobs to be persisted and executed even if my node server restarted or better its get executed even if my server is not running.
Agenda - using mongoDB, which i don't want to use.
Node-scheduler - not able to persist cron jobs
var ctab = require('crontab');
ctab.load(function(err, crontab) {
var job = crontab.create('* * * * * *');
var jobs = crontab.jobs();
crontab.save(function(err, crontab) {
});
});
The cron reads the crontab (cron tables) for running predefined scripts. By using a specific syntax, you can configure a cron job to schedule scripts or other commands to run automatically.
Using Output In a Script to Show a Running Cron Job The easiest way to see if a cron job (with its crontab settings) is working is to edit an existing cron job so that it produces a visible output. You can add a line of code in your existing script to output a result when the script is run.
Persistence Via Cron Jobs This technique involves leveraging Cron jobs to maintain persistent access to the target system by executing a reverse shell command or a web shell repeatedly on a specified schedule.
There is a few node packages to management and persist scheduled jobs:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With