I have a cron job configured at var/spool/cron/testuser, Am calling adindex.sh file from there.

Am getting results when am directly put the command directly in prompt(php and sh), But cron is not processing this one. I tried to log the cron using tail -f /var/log/cron and got:

Feb 19 04:05:01 ip-118-139-177-76 CROND[18164]: (inwhosting) CMD (/home/testuser/cronlogs/adindex.sh)

Edit: Output for crontab -l

*/5     *       *       *       *       /home/testuser/cronlogs/adindex.sh
*/5     *       *       *       *       /home/testuser/cronlogs/sendemail.sh
*/5     *       *       *       *       /home/testuser/cronlogs/sendsms.sh

Ouput of cat /home/testuser/cronlogs/adindex.sh

#wget --user=admin--password=pswd123 http://www.exmaple.com/advertiser/cron/updateindex?cron_key=Inw1234 -O /home/testuser/cronlogs/ad/log_`date "+%Y_%m_%d_%H_%M"`.txt

php /var/www/html/exmaple/cron/advt_index.php
php /var/www/html/exmaple/cron/ad_index.php

Anybody please tell me what is going wrong?

closed as off-topic by jasonwryan, Anthon, Timo, Zelda, slm Feb 20 '14 at 12:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – jasonwryan, Anthon, Timo, Zelda, slm
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    There's a typo somewhere in your question is adindex.sh a php script or a shell script. your log shows cron is attempting to execute your command, what does your command look like why do you think it isn't running ? – X Tian Feb 19 '14 at 11:31
  • My cron job is to index the solr database, and it is not indexing via cron job. I tried this via command line and works fine – Prajila V P Feb 19 '14 at 11:52
  • what is the name of your script ? is it a php script or shell script ? – Kiwy Feb 19 '14 at 12:18
  • 1
    can you edit your question to add the result of cron -l – Kiwy Feb 19 '14 at 12:58
  • 2
    Is php in cron's $PATH? – Hauke Laging Feb 19 '14 at 14:19

You have to execute it using sh; here is my example

30 11 * * * sh /home/user/backup.sh
30 17 * * * sh /home/user/backup.sh

have a look here cronjob

  • Or chmod a+x /home/user/backup.sh (assuming it has a shebang). – Patrick Feb 20 '14 at 6:07

Fixed this issue. It was a permission issue of calling sh files from cron.

Not the answer you're looking for? Browse other questions tagged or ask your own question.