# Curator Questions: Scheduling and Round-Robin

**URL:** <https://discuss.elastic.co/t/curator-questions-scheduling-and-round-robin/49705>\
**Category:** Elasticsearch\
**Created:** [May 10, 2016, 8:26pm UTC](https://discuss.elastic.co/t/curator-questions-scheduling-and-round-robin/49705 "2016-05-10T20:26:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jnpetty](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jnpetty](https://discuss.elastic.co/u/jnpetty)\
**Post date:** [May 10, 2016, 8:26pm UTC](https://discuss.elastic.co/t/curator-questions-scheduling-and-round-robin/49705/1 "2016-05-10T20:26:17Z")

</div>

So I have two questions that I have not been able to find an answer for yet. First and most annoying, is I am unable to schedule Curator to on a daily basis. I have a cron job setup as follows:

```
20 0 * * * /bin/curator --host es-1 close indices --older-than 30 --time-unit days --timestring '%Y.%m.%d'
30 0 * * * /bin/curator --host es-1 delete indices --older-than 60 --time-unit days --timestring '%Y.%m.%d'

```

The same command runs fine when I run it manually from the command line:

```
sudo curator --host es-1 close indices --older-than 30 --time-unit days --timestring '%Y.%m.%d'
sudo curator --host es-1 delete indices --older-than 60 --time-unit days --timestring '%Y.%m.%d'

```

Any idea what im missing??

Second question, as you can see from the above commands im pointing directly to the host es-1. Is there anyway of modifying this so it will pick any of the hosts in the cluster? I want the command to run even if one of the hosts is down.

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [May 10, 2016, 8:47pm UTC](https://discuss.elastic.co/t/curator-questions-scheduling-and-round-robin/49705/2 "2016-05-10T20:47:29Z")

</div>

Frequently, cron can have issues with percent signs `%` in commands. Sometimes it doesn't pick up all of the flags because it doesn't like long command lines. I recommend a wrapper script instead.

Curator shouldn't need to be run as root, by the way. It only needs access to a client host/IP address.

As far as host round robin goes, this feature is in the development version of Curator 4: [https://www.elastic.co/guide/en/elasticsearch/client/curator/4.0/configfile.html#hosts](https://www.elastic.co/guide/en/elasticsearch/client/curator/4.0/configfile.html#hosts)

It will not be back-ported to Curator 3, as the structure of Curator's configuration is so different.

---

<div class="post-metadata">

**Author:** ![jnpetty](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jnpetty](https://discuss.elastic.co/u/jnpetty)\
**Post date:** [May 10, 2016, 8:59pm UTC](https://discuss.elastic.co/t/curator-questions-scheduling-and-round-robin/49705/3 "2016-05-10T20:59:03Z")

</div>

Cool so ill move the commands into a bash script and instead call the bash script from my cron job.

Good news about the round robin, ill keep an eye on it in a future release.

---

<div class="post-metadata">

**Author:** ![jnpetty](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jnpetty](https://discuss.elastic.co/u/jnpetty)\
**Post date:** [May 10, 2016, 9:16pm UTC](https://discuss.elastic.co/t/curator-questions-scheduling-and-round-robin/49705/4 "2016-05-10T21:16:10Z")

</div>

This should work, right?

`20 0 * * * /usr/local/bin/elasticsearch-curator.sh`

With the script containing the following:

```
#closes open indices after 30 days
curator --host es-1 close indices --older-than 30 --time-unit days --timestring '%Y.%m.%d'

#delete closed indices after 60 days
curator --host es-1 delete indices --older-than 60 --time-unit days --timestring '%Y.%m.%d'

```

Is there a way to manually invoke a cron job?

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [May 10, 2016, 9:29pm UTC](https://discuss.elastic.co/t/curator-questions-scheduling-and-round-robin/49705/5 "2016-05-10T21:29:00Z")

</div>

Should work, yes. But all of the STDOUT will be emailed to you. Perhaps you will want to set a `--logfile` in these lines. You could temporarily add a `--dry-run` flag and set an additional cron entry a few minutes into the future and see what the log files show.

---

<div class="post-metadata">

**Author:** ![jnpetty](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jnpetty](https://discuss.elastic.co/u/jnpetty)\
**Post date:** [May 12, 2016, 2:46pm UTC](https://discuss.elastic.co/t/curator-questions-scheduling-and-round-robin/49705/6 "2016-05-12T14:46:47Z")

</div>

Just to close out this request, Aarons suggestion to run the commands out of a bash script worked perfectly.

---

<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 5, 2017, 10:52pm UTC](https://discuss.elastic.co/t/curator-questions-scheduling-and-round-robin/49705/7 "2017-07-05T22:52:04Z")

</div>


