Curator crontab not running

Hello. I'm running elasticsearch curator on Ubuntu. So my curator works:

curator --config /home/xen/curator/curator.yml /home/xen/curator/rollover.yml

and executing the curator creates a new index as I expected. I want to make this run every minute, so I executed crontab -e and added the following line:

* * * * * xen curator --config /home/xen/curator/curator.yml /home/xen/curator/rollover.yml

(xen is my username)

This doesn't work, therefore I tried restarting crontab using service cron restart and removing my username from the crontab -e file. Unfortunately it still doesn't work :frowning:

Here's the syslog line I got by running grep CRON /var/log/syslog:

Jul 25 08:17:01 ubuntu CRON[15144]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Binary file /var/log/syslog matches

Thanks in advance!

@babydoll

Hope i can help you but i need some information.

  1. Which python version you were using
  2. Which environment you were using.

please use the below link also to resolve the crontab problem.
http://click.pocoo.org/5/python3/
click will prematurely end promote execution since Python 3 was designed to utilize ASCII as encoding for nature.

This framework underpins the C.UTF-8 district which is prescribed.
You may have the capacity to determine your issue by sending out the
following condition factors:
export LC_ALL=C.UTF-8
export LANG=C.UTF-8

And adding to crontab:

LC_ALL=C.UTF-8
LANG=C.UTF-8

Before the curator execution and after that restart cron service.
hope the above step will help you.

Thanks :slight_smile:

Hello @akhileshsingh ! I'm using python 2.7.12 on Ubuntu!

In order to further debug your issue, you need to perform below steps:
1. Share the output for crontab -l command and the user used to set the crontab.
2. After step-1, Set the below crontab entry. This will redirect the exact crontab error in /var/log/syslog with xensu as a tag. Share the logging with xensu tag for further investigation:

* * * * * curator --config /home/xen/curator/curator.yml /home/xen/curator/rollover.yml 2>&1 | /usr/bin/logger -t xensu

3. Also, please validate the file permissions for curator.yml and rollover.yml.

Thanks

@akhileshsingh

Thank you so much for your help! Here are the results:

  1. crontab -l command output with user xen:
     # Edit this file to introduce tasks to be run by cron.
     # 
     # Each task to run has to be defined through a single line
     # indicating with different fields when the task will be run
     # and what command to run for the task
     # 
     # To define the time you can provide concrete values for
     # minute (m), hour (h), day of month (dom), month (mon),
     # and day of week (dow) or use '*' in these fields (for 'any').# 
     # Notice that tasks will be started based on the cron's system
     # daemon's notion of time and timezones.
     # 
     # Output of the crontab jobs (including errors) is sent through
     # email to the user the crontab file belongs to (unless redirected).
     # 
     # For example, you can run a backup of all your user accounts
     # at 5 a.m every week with:
     # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
     # 
     # For more information see the manual pages of crontab(5) and cron(8)
     # 
     # m h  dom mon dow   command
     * * * * * curator --config /home/xen/curator/curator.yml /home/xen/curator/rollover.yml 
    
  2. Log output with xensu:
    Jul 26 17:34:01 ubuntu CRON[17739]: (xen) CMD (curator --config /home/xen/curator/curator.yml /home/xen/curator/rollover.yml 2>&1 | /usr/bin/logger -t xensu)
    Jul 26 17:34:01 ubuntu xensu: /bin/sh: 1: curator: not found

  1. File permissions:

Read and write for owner, group and others and execute allowed for both yml files

@babydoll

I want to know how you have installed curator on your system either by using pip, source code or any other process.

It looks like that crontab is unable to find the binary of the curator.

So i request you to take output of the below commands and post it here for better understanding of your problem.

to find the binary of the curator run the below command.

whereis curator

And use the output of the above command instead of curator and set the crontab entry.
for example:

 * * * * * /usr/bin/curator --config /home/xen/curator/curator.yml /home/xen/curator/rollover.yml 2>&1 | /usr/bin/logger -t xensu

Thanks:)

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