Question

Let's say Im making a crawler / scraper in clojure, and I want it to run periodically (at predefined times of day).

I want to define my jobs with quartz / quartzite (at least that seems to be the most robust solution.)

Now, to create a daemon process with clojure, I tried lein-daemon plugin, but it seems that it is a pretty risky endevour, since the plugin seems more than a bit buggy (or I am making some heavy mistakes)

What is the best way for me to create this service? I want it to be able to restart itself upon system reboot, but I want to use clojure (quartzite) for my jobs (loading them from database, etc).

What is the robust - but clojury - way to create a long-running, daemon process?

EDIT:

The deployment environment will be something like a single VPS or a dedicated server. There may be a dozen jobs loading their parameters from some data store, running anywhere from 1 - 8 times a day (or maybe more).

Was it helpful?

Solution

The correct process depends a lot on your environment. I work on deployment systems for complex web/mobile infrastructure with many long running Clojure processes. For this we use Pallet to create instances with the code checked out and configured, then we have a function that generates init scripts to start the services at boot. This process is appropriate to environments where you need a repeatable build on a cloud provider so it may be too heavy for your situation.

If you are looking for simple recurring jobs you may want to look into Immutant which is an application server for Clojure with good support for recurring jobs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top