O
O
Orkhan Hasanli2020-10-15 12:52:52
Java
Orkhan Hasanli, 2020-10-15 12:52:52

How to run java app with cron?

Good afternoon, colleagues!
I wrote a small parser that parses data through jsoup, and then exports it to a WP site through the REST API.
This script needs to be run by cron. This begs the question - what is the best way to implement this?
1) The first option - jar'nick lies somewhere on the server and cron runs it periodically. Those. a separate job is created for CRON
2) The second option is to use libraries for Schedule (for example, Wisp )
But then the question arises ... it turns out that the application must run in the background in order for the code for the CRON daemon to work? What then needs to be done? Make a loop while(true){}to keep the application from terminating. And create an init.d service that will launch the application each time the system is restarted?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BorLaze, 2020-10-15
@azerphoenix

Cron, of course.
It is designed for this. What for to hang on application superfluous functions?
Should it parse the data and send it somewhere? So let him do this, and how often he should do it - for this, let the crown have a headache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question