quickshiftin / wfpc

Magento full page cache warmer
GNU General Public License v3.0
101 stars 28 forks source link

Cannot run in cron #1

Closed airoptix closed 8 years ago

airoptix commented 8 years ago

I can't run it in cronjob.

In command line works fine, but when adding to cron, does nothing, just sending the usage options by mail.

In command line is working just this way: php wfpc.php -w d=1 test/warm.xml

Not working like this: ./wfpc.php -w d=1 test/warm.xml (by this way, the same happens: just the usage option)

quickshiftin commented 8 years ago

The problem is almost certainly that when running the cronjob, your system can't find the correct path to the php executable. To find out the full path to php on your system type which php on the command line. Then put that into your cronjob configuration, such as

I'm not sure, but if the result of which php is different than /usr/bin/php you might be able to update the first line of the script and not have to put the full path in your cronjob configuration.

airoptix commented 8 years ago

That is the full path. /home/username/public_html/wfpc.php

I am sure, problem is not at my side. In putty, it is working fine.

Cronjob is set properly, another PHP file run perfectly with the same settings in same directory.

  1. júl. 14. 23:49 ezt írta ("Nathan Nobbe" notifications@github.com):

The problem is almost certainly you need to specify the full path to php in the cronjob configuration. To find out the full path to php on your system type

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/quickshiftin/wfpc/issues/1#issuecomment-232802869, or mute the thread https://github.com/notifications/unsubscribe/ATcJ5o-_vFlxpSexUf1pW1QcYHy-1UDHks5qVq70gaJpZM4JM4i8 .

quickshiftin commented 8 years ago

Are the other php files that work marked as executable with a line like #!/usr/bin/php at the top? Maybe try taking that line out of the script and using the full path to php as I suggested. There's nothing about the script that should prevent it from working inside a cronjob.

airoptix commented 8 years ago

Ok. I try this way, and let you know. But the wfpc.php file is found and run, because it's output is sent to me by the server in mail. But the output is just the usage instructions immediately, not going through the sites like in putty. There is not any not found error.

  1. júl. 14. 23:58 ezt írta ("Nathan Nobbe" notifications@github.com):

Are the other php files that work marked as executable with a line like

!/usr/bin/php at the top? Maybe try taking that line out of the script

and using the full path to php as I suggested. There's nothing about the script that should prevent it from working inside a cronjob.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/quickshiftin/wfpc/issues/1#issuecomment-232804905, or mute the thread https://github.com/notifications/unsubscribe/ATcJ5vP8WmTGk5ckPoezz3CE2JFoo-Izks5qVrEEgaJpZM4JM4i8 .

quickshiftin commented 8 years ago

Ok. If I have some time I'll see if I can test on my end in a crontab as well.

airoptix commented 8 years ago

I can try it tomorrow only.

  1. júl. 15. 0:03 ezt írta ("Nathan Nobbe" notifications@github.com):

Ok. If I have some time I'll see if I can test on my end in a crontab as well.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/quickshiftin/wfpc/issues/1#issuecomment-232806036, or mute the thread https://github.com/notifications/unsubscribe/ATcJ5s_kfQm6o8WAVeHwR3G_cr04dKbVks5qVrIvgaJpZM4JM4i8 .

quickshiftin commented 8 years ago

Hi, I just tested this in a crontab and it works fine on my machine. I'm not sure exactly what the problem is, here is what I have in my test case for the crontab

* * * * * /home/nathan/gitRepos/wfpc/wfpc -w -d http://trendy-tees.local/sitemap.xml >> /tmp/wfpc-cron.log

And on my system which php output is /usr/bin/php

airoptix commented 8 years ago

The other php does not have this #!/usr/bin/php at the top. It is the magento's cron.php file. But it also has a cron.sh file, that is related to this cron.php. I'm not too familiar with linux, but I think this .sh file is neccessary to work.

Anyway, I set up the log file also, but the output is the same: only the usage commands.

I am sure the wfpc.php file is being run, but not working. Maybe there is some kind of time limit on cron running, and it cannot run through, that's why it immedately goes to usage options.

I think I give this up.