Need to send email based on date and time in the database, like if the difference is 24 hours for current date and database stored date, that time need to trigger email. So for this i created cron-job to send email for each 1 hour but it seems not working? So i can use this Cron-job to achieve this, Please help us to achieve?
Are you referring to an external cron-job or the Wix Job Scheduler?If last, what is not working? Show us the code, please.
Using Wix Job Scheduler only, below is my code
{
"jobs": [
"functionLocation": "/module/dbUtils.js",
"functionName": "test",
"description": "describe your job",
"executionConfig": {
"cronExpression": "0 * * * *"
}
}
]
}
In test function printing some string in console. We need to call this Jobs any where in front code?
Is this code copied correctly? Because you are missing a bracket. It should be:
{
"jobs": [
{
"functionLocation":
Note the bracket underneath “jobs”.
I missed bracket during copy
{
“jobs” : [ // Define up to 20 different jobs
// Choose one of the options below to define the job execution interval:
{
// Option 1 - define execution interval using a cron expression
“functionLocation” : “/module/dbUtils.js” , // Relatively to Backend folder, started by slash
“functionName” : “test” ,
“description” : “describe your job” , // Optional
“executionConfig” : {
“cronExpression” : “0 * * * *”
}
]
}
Looks OK to me. But when I saw this (in your first question):
In test function printing some string in console . We need to call this Jobs any where in front code ?
I started to wonder if you have correctly put this schedule in the MANDATORY file called jobs.config? It cannot reside in front end code nor in backend code. It must be in the mentioned file.
Yes i given that code with in jobs.config file in backend folder
And you have Published it and tested it in Live Mode?
Yes Published and tested in Live Mode
Can you share document or code for cron-job with function to print string for implementing, it would be helpful