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

Android Timer schedule vs scheduleAtFixedRate

The difference is best explained by this non-Android documentation: Fixed-rate timers (scheduleAtFixedRate()) are based on the starting time (so each iteration will execute at startTime + iterationNumber * delayTime). In fixed-rate execution, each execution is scheduled relative to the scheduled execution time of the initial execution. If an execution is delayed for any reason (such … Read more

Schedule Python Script – Windows 7

You can do it in the command line as follows: schtasks /Create /SC HOURLY /TN PythonTask /TR “PATH_TO_PYTHON_EXE PATH_TO_PYTHON_SCRIPT” That will create an hourly task called ‘PythonTask’. You can replace HOURLY with DAILY, WEEKLY etc. PATH_TO_PYTHON_EXE will be something like: C:\python25\python.exe. Check out more examples by writing this in the command line: schtasks /? Otherwise … Read more

Specifying the running directory for Scheduled Tasks using schtasks.exe

Just wanted to add details that are valid for Windows Server 2008 and 2012. As many people can understand screen shots better here is a screen shot: To sum it up. When you create the action for your scheduled task you have the option to set the “Start in (optional)” field (rounded in red on … Read more

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

Windows Task Scheduler doesn’t start batch file task

Make sure you set the ‘Start in’ and ‘Program/script’ options correctly. If your file address is: C:\Temp\foo.bat, set the ‘start in’ option to ‘C:\Temp’ and the ‘Program/script’ option to ‘foo.bat’. To set the ‘Start in’ option: Right click task in the task scheduler > Properties > Actions > Edit. If this alone doesn’t work then … Read more