2

I am using php 5.3.3 and Apache 2.0 with codeigniter framework. In that i have set cron job for download file for every minutes. When i run my function through url it is working. But in cron job set means not working. I have set cron using root login and checked in cmd, it shows it running. This is my url, http://ef.efvoice.com/artbak/index.php?module=sales&view=auto_download

But it not download any files. So for that i have check using DB insert instead of download code. For that also not working. Below i have given the cron set code ,

crontab -e -u myusername

*/1 * * * * wget -O - http://ef.efvoice.com/artbak/index.php?module=sales&view=auto_download

*/1 * * * * lynx http://ef.efvoice.com/artbak/index.php?module=sales&view=auto_download

/etc/init.d/crond restart

I have set both ways in cron wget -o and lynx . But when i check in same cmd mode,

tail /var/log/cron 

it shows it running . I don't know what mistake i did. So please any one help me. Thanks in advance.

I have tried these steps also, check screen shot, but not working. If any other ways are there.

enter image description here

Jagan Akash
  • 559
  • 5
  • 26
  • My server hosted in Singapore , so i am accessing from India, maybe this will create any issues? I don't know why it is not working? – Jagan Akash Aug 06 '15 at 07:13
  • May be any path problems, my file path /var/www/html/....... like this. Or any permission problems? Kindly guide me . – Jagan Akash Aug 06 '15 at 09:28
  • This entry may be your solution : http://stackoverflow.com/questions/11375260/cron-command-to-run-url-address-every-5-minutes – mariek Aug 06 '15 at 10:04
  • i have checked your link and tried also, not working. Check my above image. – Jagan Akash Aug 06 '15 at 12:07

2 Answers2

2

try using the server path,

php -f /home/usr/public_html/ef.efvoice.com/artbak/index.php

and you'll need to be in a page without the login requirement

Kup
  • 882
  • 14
  • 31
  • Changed the code without login and tried in many ways, not working. Check my screenshot. – Jagan Akash Aug 06 '15 at 12:08
  • 1
    if you use the server path, then try : php -f /home/usr/public_html/ef.efvoice.com/artbak/index.php controller_name method_name – mariek Aug 06 '15 at 13:06
  • 1
    check the man page for CLI : http://www.codeigniter.com/user_guide/general/cli.html – mariek Aug 06 '15 at 13:07
0

I tried in so many ways and finally i find a solution for this. The problem is missing single quotes to add before and after my url. Now this is working perfectly. Thank you so much guys who supported/guided to me.

curl --request GET 'http://ef.efvoice.com/art/index.php?module=auth&view=auto_download'

Jagan Akash
  • 559
  • 5
  • 26