3

my crontab is as follows:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
01 04 * * * root /home/sphinx_scripts/daily_update_index.sh

daily_update_index.sh is as follows:

indexer  --rotate xxx

now if I run /home/sphinx_scripts/daily_update_index.sh from anywhere(as root), it works fine. But I get emails daily from cron job saying "command indexer is not found". the full path of the indexer is /usr/loca/bin/indexer. Why would I get such an error?

2 Answers 2

7

The issue is that indexer is not on the path. You say it is /usr/local/bin/indexer and you have PATH=/sbin:/bin:/usr/sbin:/usr/bin
To fix this I would put the whole path to indexer in daily_update_index.sh or add /usr/local/bin to the path in daily_update_index.sh

Sign up to request clarification or add additional context in comments.

Comments

0

I'm working on an AWS EC2 instance and for me the issue was that I used pscp to transfer my .sh file from my Windows 10 machine, and the file's line endings were incompatible. So I used sudo apt-get install dos2unix and then used dos2unix to convert the file to the correct format.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.