Hi,
This sounds a bit dumb, but I don't seem to be able to run curator on as cronjob. I 've already checked out https://github.com/elasticsearch/curator/pull/87 and https://github.com/elasticsearch/curator/issues/121
My crontab (for root) looks like this:
$: crontab -l
*/1 * * * * /usr/local/bin/curator bloom --older-than 2 &>> /var/log/opt/curator.log
*/1 * * * * /usr/local/bin/curator optimize --older-than 2 &>> /var/log/opt/curator.log
*/1 * * * * /usr/local/bin/curator close --older-than 7 &>> /var/log/opt/curator.log
*/1 * * * * /usr/local/bin/curator delete --older-than 14 &>> /var/log/opt/curator.log
*/1 * * * * env > /tmp/cronenv
Cron is running, so I suppose I should see something in /var/log/opt/curator.log after a while, but nothing appeared. I don't see the process while doing ps either. This make me suspect whether it's acutually running
Running the command manually works, however
$: /usr/local/bin/curator bloom --older-than 2 &>> /var/log/opt/curator.log
gives
$: cat /var/log/opt/curator.log
2014-08-22 02:57:01,653 INFO Job starting...
2014-08-22 02:57:01,655 INFO Beginning BLOOM operations...
2014-08-22 02:57:01,659 INFO logstash-2014.08.21 is within the threshold period (2 days).
2014-08-22 02:57:01,659 INFO logstash-2014.08.22 is within the threshold period (2 days).
2014-08-22 02:57:01,659 INFO DISABLE BLOOM FILTER index operations completed.
2014-08-22 02:57:01,659 INFO Done in 0:00:00.010454.
I logged my cron env when i run them too, which is
LANGUAGE=en_US:
HOME=/root
LOGNAME=root
PATH=/usr/bin:/bin
LANG=en_US
SHELL=/bin/sh
PWD=/root
seems to be a mistake on io redirection on my end. Changed them to be
/usr/local/bin/curator bloom --older-than 2 >> /var/log/opt/curator.log 2>&1 and it works
I had the same issue with crontab. Turns out crontab only allows so many characters in the command. Otherwise it truncates the command and tries to run it anyway. My solution was to have the crontab call a bash file that runs the curator command. Then everything starting working.
Another thing I ran into was unescaped percent signs. I was using the command:
/usr/local/bin/curator delete indices --older-than 10 --time-unit days --timestring '%Y.%m.%d'
But I had to escape the percent signs, like so:
/usr/local/bin/curator delete indices --older-than 10 --time-unit days --timestring '\%Y.\%m.\%d'
Now my curator cron jobs run swimmingly!
@geerlingguy Thank you, it solved my problem too!
@geerlingguy This just solved my issue as well.
@geerlingguy helped. Thanks!
@geerlingguy thanks
Most helpful comment
Another thing I ran into was unescaped percent signs. I was using the command:
But I had to escape the percent signs, like so:
Now my curator cron jobs run swimmingly!