# Jdbc scheduler vs linux cron

**URL:** <https://discuss.elastic.co/t/jdbc-scheduler-vs-linux-cron/62297>\
**Category:** Logstash\
**Created:** [October 5, 2016, 5:07pm UTC](https://discuss.elastic.co/t/jdbc-scheduler-vs-linux-cron/62297 "2016-10-05T17:07:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Igal\_Karlinsky](https://avatars.discourse-cdn.com/v4/letter/i/a87d85/32.png) [@Igal\_Karlinsky](https://discuss.elastic.co/u/Igal_Karlinsky)\
**Post date:** [October 5, 2016, 5:07pm UTC](https://discuss.elastic.co/t/jdbc-scheduler-vs-linux-cron/62297/1 "2016-10-05T17:07:23Z")

</div>

Hi,

I want to keep my sql DB synced with ELK.  
I'm wondering, are there any advantages using jdbc scheduler against native linux cron?

thanks.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 5, 2016, 5:29pm UTC](https://discuss.elastic.co/t/jdbc-scheduler-vs-linux-cron/62297/2 "2016-10-05T17:29:40Z")

</div>

If you use the built-in scheduler you don't risk overlapping executions, i.e. that execution 2 starts before execution 1 has completed. Also, I don't think Logstash shuts down after the first run if you _don't_ have a schedule set, so how would you know when to shut down?

---

<div class="post-metadata">

**Author:** ![Igal\_Karlinsky](https://avatars.discourse-cdn.com/v4/letter/i/a87d85/32.png) [@Igal\_Karlinsky](https://discuss.elastic.co/u/Igal_Karlinsky)\
**Post date:** [October 5, 2016, 9:06pm UTC](https://discuss.elastic.co/t/jdbc-scheduler-vs-linux-cron/62297/3 "2016-10-05T21:06:38Z")

</div>

You probably right with execution overlapping, though it's not the case for me. I plan to sync it once in 1h, each sync takes less than 1 minute. Regarding Logstash shutdown, I'm not quite understand. According to documentation " If no schedule is given, then the statement is run exactly once", and that's what I see.  
My main concern is not to be dependent on connectivity to the ELK server.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 6, 2016, 5:42am UTC](https://discuss.elastic.co/t/jdbc-scheduler-vs-linux-cron/62297/4 "2016-10-06T05:42:50Z")

</div>

> You probably right with execution overlapping, though it's not the case for me. I plan to sync it once in 1h, each sync takes less than 1 minute.

In the normal case, yes. Do not assume that such will always be the case. I'm sure there are many pathological cases where a sync could take longer than that. What if the database server is down? What if you your switch or router breaks down and slows all network traffic to a crawl? What if both things happen at the same time? Unless you want to find out what happens I suggest you choose a resilient design.

> Regarding Logstash shutdown, I'm not quite understand. According to documentation " If no schedule is given, then the statement is run exactly once", and that's what I see.

Yes, it's run only once but does it shut down Logstash after that sync? If not, you're going to start an extra Logstash instance every hour.

---

<div class="post-metadata">

**Author:** ![Igal\_Karlinsky](https://avatars.discourse-cdn.com/v4/letter/i/a87d85/32.png) [@Igal\_Karlinsky](https://discuss.elastic.co/u/Igal_Karlinsky)\
**Post date:** [October 6, 2016, 6:37am UTC](https://discuss.elastic.co/t/jdbc-scheduler-vs-linux-cron/62297/5 "2016-10-06T06:37:57Z")

</div>

> Yes, it's run only once but does it shut down Logstash after that sync? If not, you're going to start an extra Logstash instance every hour.

I guess so, I get this print at the end - **Pipeline main has been shutdown**

Anyway, @magnusbaeck - thanks for the clarification.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:35am UTC](https://discuss.elastic.co/t/jdbc-scheduler-vs-linux-cron/62297/6 "2017-07-06T04:35:29Z")

</div>

Closed on July 6, 2017, 4:35am UTC


