Curator is not running from crontab

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

  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.
  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$

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.

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