Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to run a php script using cron
    primarykey
    data
    text
    <p>I have 2 php scripts which need to run every few minutes, the php itself is fine as I can trigger it manually by typing <code>http://myfakesite.com/myphpfile.php</code> into a browser. Both work as they should.</p> <p>I don't have much experience with cron but I have found the crontab file (I am using Parallels Power Panel on a VPN), and it already had jobs to run-parts cron.hourly, daily, weekly and monthly. I added my email address to the MAILTO field, and get a message telling me that cron.hourly is not a directory - even though it is (although it is currently empty).</p> <p>I also added my own 2 jobs to this file as follows:</p> <pre><code>*/1 * * * * wget http://myfakesite.com/script1.php */5 * * * * wget http://myfakesite.com/script2.php </code></pre> <p>Neither of these ever get called. In the php script I also have a line to email me once the script is called, so that I know it is working, and have never received an email via the cronjob. If I ssh into the server and use wget the php works and emails me to confirm.</p> <p>I have also tried</p> <pre><code>*/1 * * * * php http://myfakesite.com/script1.php </code></pre> <p>and</p> <pre><code>*/1 * * * * wget -O /dev/null http://myfakesite.com/script1.php&gt;/dev/null 2&gt;&amp;1 </code></pre> <p>with no luck. The MAILTO in the crontab file never sends me a message to say there was a problem running the script, but clearly it is not doing it.</p> <p>Can anyone help at all? I have no idea what to try next.</p> <p>Edit: Found some info that said that the 'not a directory' error can be down to a corrupt crontab file. So I downloaded it copied the info to a new file and uploaded that. The 'not a directory' error disappeared...COMPLETELY. Even if I tell it to look for a folder which I know doesn't exist like cron.myfakefolder I don't get a <code>Not a directory: /etc/cron.myfakefolder</code> email. Replaced my new crontab file with the original, and I'm still not getting any feedback from the cronjob.</p> <p>Edit 2: As dAm2K and prodigitalson suggested, I tried using the absolute paths to both wget and php. Neither have worked, and I've double checked the locations of usr/bin/wget and usr/bin/php just to make sure they were actually there. I also checked var/log/cron and var/log/messages, both contained this:</p> <p>2002Can't perform "download" operation: Requested file "/var/log/cron" is to big to be sent at once. Try to request file in pieces of 512KB</p> <p>No idea what is happening with this. As I mentioned in edit 1, I'm also no longer receiving error emails even when I purposely add a false location. Is this related to the error in the log files?</p> <p>Also, I have checked that crond is running and according to both 'System Services' and 'System Processes' it is running.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload