How to change Spring’s @Scheduled fixedDelay at runtime?

In spring boot, you can use an application property directly! For example: @Scheduled(fixedDelayString = “${my.property.fixed.delay.seconds}000″) private void process() { // your impl here } Note that you can also have a default value in case the property isn’t defined, eg to have a default of “60” (seconds): @Scheduled(fixedDelayString = “${my.property.fixed.delay.seconds:60}000”) Other things I discovered: the … Read more

Powershell script does not run via Scheduled Tasks

Change your Action to: powershell -noprofile -executionpolicy bypass -file C:\path\event4740.ps1 On a Windows 2008 server R2: In Task Scheduler under the General Tab – Make sure the ‘Run As’ user is set to an account with the right permissions it takes to execute the script. Also, I believe you have the “Run only when user … Read more

How to run a Jupyter notebook with Python code automatically on a daily basis?

Update recently I came across papermill which is for executing and parameterizing notebooks. https://github.com/nteract/papermill papermill local/input.ipynb s3://bkt/output.ipynb -p alpha 0.6 -p l1_ratio 0.1 This seems better than nbconvert, because you can use parameters. You still have to trigger this command with a scheduler. Below is an example with cron on Ubuntu. Old Answer nbconvert –execute … Read more

PowerShell script won’t execute as a Windows scheduled task

If the problem you’re having is with Execution Policy, then you can also set the execution policy of a specific invocation of PowerShell. This is what I usually do when executing PowerShell through a scheduled task: powershell.exe -NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File \\path\to\script.ps1 Why? -NoProfile This ensures that you don’t rely on anything in … Read more

How I can run my TimerTask everyday 2 PM?

Calendar today = Calendar.getInstance(); today.set(Calendar.HOUR_OF_DAY, 2); today.set(Calendar.MINUTE, 0); today.set(Calendar.SECOND, 0); // every night at 2am you run your task Timer timer = new Timer(); timer.schedule(new YourTask(), today.getTime(), TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS)); // period: 1 day

Golang: Implementing a cron / executing tasks at a specific time

This is a general implementation, which lets you set: interval period hour to tick minute to tick second to tick UPDATED: (the memory leak was fixed) import ( “fmt” “time” ) const INTERVAL_PERIOD time.Duration = 24 * time.Hour const HOUR_TO_TICK int = 23 const MINUTE_TO_TICK int = 00 const SECOND_TO_TICK int = 03 type jobTicker … Read more