To schedule a spring batch job dynamically with annotations - cron

I need to schedule a spring batch job from controller with dynamic cron value. In application there is a page where User can change the details of the job like start time, end time and the days it can be run. So once user changes any details and saves, it comes to controller. From controller I need to create the cron expression and schedule the job. If User changes again, the job needs to be rescheduled. Anyone let me know how to do it.

Related

Time triggered web job Scheduler start only after running it manually

I have created a Time triggered web job and after deploying it I need to run it manually for the first time. After the manual start, it run at a specified interval.
Is it possible scheduler start without clicking on run button?
Is it possible scheduler start without clicking on run button?
After reproducing issue from my side AFAIK ,
In webjob we need to run it manually for the first time after the manual start, it run at a specified interval.
But if you want to run it manually with out clicking on RUN it is possible in logicapps.
If you are okay with the alternative method try to follow the below steps of logic App.
1.Created Web jobs in App service as expected it is running after clicking on refresh or Run buttons
2. So for manual trigger of webjob followed the document and created logicapp and got the espected results.
3. Created logicapp workflow as shown below .
Here taking Recurrence trigger it runs every 3 minutes.You can change the interval and frequency based on your requirement
4.Next taking HTTP action in HTTP action fill the below details
Method: POST
URI: Web job URL
Authentication type: Basic
Username
Password
In appservice select the webjob and click on properties there you will get URL ,USER NAME and PASSWORD as shown in below image.
Then click on SAVE and RUN the trigger then it automatically runs based on the schedule.
Logic App ran successfully as shown below
In overview look for Run history for the results. Now the application would trigger the webjobs as per the schedule.
As shown in runhistory based on my interval it runs once in every three minutes.
Also try to refer this

Send Reminder to User and inform him about his plan expiry Django

Hi I want to create a payment plan expiry reminder using django
Current Solution
Create a management command
Run the management command as a cron job
Problems with the Current sollution
in windows cron job doesn't work
it will run at particular time for all the users
I don't want to run cron for every minute
But i want to notify the user when 50%,30%,20%,10% and 5% time is remaining.
What I'm looking for
I'm trying to do something that can be done using the expiry_date ('available in the membership model of user and plan ')
using which we can just look at the membership which are expiring and notify them only.
final and most important i don't want to run a cron job every minute , but want to achieve a functionality which lets the user even remind that you have just 10mins remaining ,5 mins remaining kind of notifications.
as the process is for learning I'm not looking for any paid API's

Email if a cron job succeeds on Cronitor

Is it possible to add a setting on Cronitor that sends an email once a cron job succeeds. Right now I only get email if a cron job fails.
This is what i have at the moment :
Alert preferences Failure tolerance Duration alerts
Alert notes
(X) Send alerts any time there is a problem
() Only send alerts if my job has consistently not run when expected...
I tried to email/contact support but now answer from Cronitor yet.
I'm one of the creators of Cronitor. I'm really sorry we somehow missed your support inquiry.
The answer is that, yes, this is possible but you cannot set this up without an API call. After the initial setup is complete (and the new alert rule is added) you can continue managing the monitor from the dashboard.
If you email support#cronitor.io again with specifics I can help you with adding this rule via the API.

How to schedule email newsletter

How to schedule an email newsletter? Documentation seems to missing that. I have newsletter with widget that will take news from last 2 weeks. I would like to automatically send that newsletter every 2 weeks.
Kentico 11
Re-sending newsletters based on some interval (e.g every week) is not supported in Kentico at this time. It is possible through some customization, however.
By scheduling a newsletter to be sent at some time in the future, a scheduled task is created in the Scheduled Tasks application (under your site > System Tasks). This task only runs once and is then deleted, but you can alter the configuration of the task to run periodically and not delete itself. Or, you can manually create a task that uses CMS.Newsletters.QueueSender and TaskData equal to the issue's GUID.
There is another issue to solve once the task has been scheduled to run periodically- the issue's IssueStatus will be changed to Finished (5) after it is sent the first time, but the QueueSender will only re-send the issue if the status is ReadyForSending (1).
You can use an object event handler or custom scheduled task to automatically change the IssueStatus to 1 before the issue is sent once again.

schedule email to send at a later date using nodemailer/node-cron

I have a private beta sign up field that will instantly send an email notifying the user to look out for an approval email with a special key to sign up then send out an email with the special key at a later scheduled date.
send.pre_approval(function(){
new Cron({
cronTime: // some later time,
onTick: function(){
send.approval()
this.stop()
}
}).start()
})
send.pre_approval will send out the pre_approval email immediately upon signing up for the private beta. The cron job is set to fire some time later and the onTick function that fires at the set cronTime will send out the approval email then call its stop method.
This seems to work as I expected but I was wondering if this is the way to stop the cron job using node-cron.
I'm essentially scheduling a job and stopping it once it runs, it seems like the better way would be to schedule the job to run at a later time from the sign up time, any ideas?
My co-worker brought up a better solution that makes more sense.
Schedule a cron job that checks the creation_date field of a user that signs up and after a set amount of time has passed since the creation_date send out an email.
This way there is not a cron job for each user.

Resources