# Curator is not running from crontab

**URL:** <https://discuss.elastic.co/t/curator-is-not-running-from-crontab/175851>\
**Category:** Elasticsearch\
**Tags:** curator\
**Created:** [April 8, 2019, 1:47pm UTC](https://discuss.elastic.co/t/curator-is-not-running-from-crontab/175851 "2019-04-08T13:47:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PraveenKT](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praveenkt/32/35483_2.png) [@PraveenKT](https://discuss.elastic.co/u/PraveenKT)\
**Post date:** [April 8, 2019, 1:47pm UTC](https://discuss.elastic.co/t/curator-is-not-running-from-crontab/175851/1 "2019-04-08T13:47:47Z")

</div>

When I run the curator command in crontab, cron logs show ing job was completed but in curator logs showing old logs, not the time when cronjob ran.  
Crontab is working for remain all commands.  
Same command is working fine when ran normally.

-bash-4.2$ sudo crontab -l  
**41 06 \* \* \* sudo /opt/elasticsearch-curator/curator --config /opt/curator/curator-config.yml /opt/curator/curator-action.yml --dry-run**  
**40 06 \* \* \* sudo /usr/bin/curator --config /opt/curator/curator-config.yml /opt/curator/curator-action.yml --dry-run**

-bash-4.2$ sudo whereis curator  
curator: /usr/bin/curator

-bash-4.2$ sudo tail /var/log/cron  
Apr 8 06:38:55 uslv-sapp-elk01 crontab[28499]: (root) REPLACE (root)  
Apr 8 06:38:55 uslv-sapp-elk01 crontab[28499]: (root) END EDIT (root)  
Apr 8 06:39:01 uslv-sapp-elk01 crond[1375]: (root) RELOAD (/var/spool/cron/root)  
**Apr 8 06:40:01** uslv-sapp-elk01 CROND[28651]: (root) CMD (/usr/lib64/sa/sa1 1 1)  
**Apr 8 06:40:01** uslv-sapp-elk01 CROND[28652]: (root) CMD (sudo /usr/bin/curator --config /opt/curator/curator-config.yml /opt/curator/curator-action.yml --dry-run)  
Apr 8 06:41:01 uslv-sapp-elk01 CROND[28724]: (root) CMD (sudo /opt/elasticsearch-curator/curator --config /opt/curator/curator-config.yml /opt/curator/curator-action.yml --dry-run)

-bash-4.2$ sudo tail -n 3 /var/log/curator/curator.log  
2019-04-08 06:17:41,293 INFO (CLOSED) indices may be shown that may not be acted on by action "delete\_indices".  
2019-04-08 06:17:41,293 INFO Action ID: 3, "delete\_indices" completed.  
**2019-04-08 06:17:41,293 INFO** Job completed.  
-bash-4.2$

OS: RedHat LInux 7.5  
-bash-4.2$ sudo java -version  
openjdk version "1.8.0\_181"  
OpenJDK Runtime Environment (build 1.8.0\_181-b13)  
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)  
elasticsearch-6.6.0-1.noarch  
elasticsearch-curator-5.6.0-1.x86\_64  
OS: RedHat LInux 7.5  
-bash-4.2$ sudo java -version  
openjdk version "1.8.0\_181"  
OpenJDK Runtime Environment (build 1.8.0\_181-b13)  
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)  
elasticsearch-6.6.0-1.noarch  
elasticsearch-curator-5.6.0-1.x86\_64

---

<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:** [April 8, 2019, 2:13pm UTC](https://discuss.elastic.co/t/curator-is-not-running-from-crontab/175851/2 "2019-04-08T14:13:23Z")

</div>

1. You really don't need `sudo` to run Curator. It doesn't need root access at all. It just needs client access to Elasticsearch. If you want it to log to `/var/log/curator`, just change permissions there so it can write to the log files in that directory.
2. What user is this `crontab` in? Does it have read access to the config files? That also sounds like a permissions issue.
3. Why are the two commands with different paths? `/opt/elasticsearch-curator/curator` vs. `/usr/bin/curator`? These should be consistent. You also have them both executing at exactly the same time, `06:40` That could cause some odd behavior.

---

<div class="post-metadata">

**Author:** ![PraveenKT](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praveenkt/32/35483_2.png) [@PraveenKT](https://discuss.elastic.co/u/PraveenKT)\
**Post date:** [April 8, 2019, 3:51pm UTC](https://discuss.elastic.co/t/curator-is-not-running-from-crontab/175851/3 "2019-04-08T15:51:35Z")

</div>

1. I am running each and every command from staring of ELK stack with sudo only. So there is no problem if i use sudo, correct me if i am wrong. To avoid permission issues I am running every command with sudo.

2. below cmd output shows i have write access in crontab  
-bash-4.2$ **sudo ls -l /var/spool/cron/**  
total 8  
**-rw-** ------. 1 pteegala-adm domain users 34 Apr 2 05:26 pteegala-adm  
**-rw-** ------. 1 root root 253 Apr 8 06:38 root  
-bash-4.2$

-bash-4.2$ sudo ls -l /opt/curator/  
total 20  
-rw-r--r--. 1 root root 3379 Apr 1 20:22 xxxx.pem  
-rw-r--r--. 1 root root 1452 Apr 2 03:53 curator-action.yml  
-rw-r--r--. 1 root root 380 Apr 2 03:47 curator-config.yml  
-rw-r--r--. 1 root root 1704 Apr 1 20:21 curator.key  
-rw-r--r--. 1 root root 0 Apr 2 05:15 curator.log  
-rw-r--r--. 1 root root 1789 Apr 1 20:21 curator.pem

1. below cmd ouput indicate 2 locations so i am trying testing separate commands for each loccation. I am running both commands with 1 minute difference (40 & 41 minute).

-bash-4.2$ sudo ls -l /usr/bin/ | grep curator  
lrwxrwxrwx. 1 root root 34 Mar 26 06:51 curator -\> /opt/elasticsearch-curator/curator  
lrwxrwxrwx. 1 root root 38 Mar 26 06:51 curator\_cli -\> /opt/elasticsearch-curator/curator\_cli  
lrwxrwxrwx. 1 root root 38 Mar 26 06:51 es\_repo\_mgr -\> /opt/elasticsearch-curator/es\_repo\_mgr  
-bash-4.2$

-bash-4.2$ **sudo ls -l /var/spool/cron/**  
total 8  
**-rw-** ------. 1 pteegala-adm domain users 34 Apr 2 05:26 pteegala-adm  
**-rw-** ------. 1 root root 253 Apr 8 06:38 root  
-bash-4.2$

---

<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:** [April 11, 2019, 2:56pm UTC](https://discuss.elastic.co/t/curator-is-not-running-from-crontab/175851/4 "2019-04-11T14:56:01Z")

</div>

This appears to be a shell/cron/permissions issue combination. It is not a Curator issue. I'm not able to help you troubleshoot the shell very easily, or quickly. I am sorry for the inconvenience, but the answer to your question is not to be found within Curator, but in how you are executing it. This is clearly demonstrated in that Curator runs perfectly fine from the command-line, but not from cron.

---

<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:** [May 9, 2019, 2:56pm UTC](https://discuss.elastic.co/t/curator-is-not-running-from-crontab/175851/5 "2019-05-09T14:56:08Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
