I want run a background process at a specific time. I want that process to be run on the server even without running the application from End-User side. The application is made using Spring. Please suggest how to approach for it. Thanks and regards Souvik
-
what operation system?Ivan– Ivan2014-12-03 09:15:49 +00:00Commented Dec 3, 2014 at 9:15
-
2Have you tried quartz-scheduler.orgRookie007– Rookie0072014-12-03 09:17:20 +00:00Commented Dec 3, 2014 at 9:17
-
1Since you are using Spring you can also check at Spring Quartzrajesh– rajesh2014-12-03 09:20:04 +00:00Commented Dec 3, 2014 at 9:20
-
consider using quartz or java timer APIPrasad Khode– Prasad Khode2014-12-03 09:22:59 +00:00Commented Dec 3, 2014 at 9:22
-
Is the program that you want to run as daemon already developped ??neo– neo2014-12-03 09:25:16 +00:00Commented Dec 3, 2014 at 9:25
1 Answer
I depends highly on what platform you are working on, and what you want to achieve.
If it is a simple application, that you simply want to invoke that on specific time, then you can use scheduling tools available on your platform, for example, crontab for Unix, or scheduled task (at) for Windows.
If you want the application to be run as a daemon process, and the application itself will handle the scheduling, then you need to solve two problem: 1. create a daemon process (aka system service), and 2. doing scheduling in Java.
For problem 1, there are already answer for it. Just have a search on Google on "Java System Service" will give you some other useful tools too, like Java Service Wrapper
For problem 2, there are a lot of way to perform scheduling in Java. You can do it by built-in Timer etc, or using scheduling library like Quartz