Regarding this:
42 3-22 * * * /var/www/apache2-default/getUserDetails.php?friend=14522828
You can't put the ?
there. It will consider the ?
along with the rest after it as part of the file name from the file system (it's looking for the file getUserDetails.php?friend=14522828
at /var/www/apache2-default
). What you can do is:
42 3-22 * * * /usr/bin/php-cgi /var/www/apache2-default/getUserDetails.php friend=14522828
(assuming the php-cgi executable is in /usr/bin, change accordingly if php is installed elsewhere)
Alternatively, you could edit getUserDetails.php and have the following line at the very top of the file:
#!/usr/bin/php-cgi
<?php
[your code goes here]
...
Then make sure getUserDetails.php is executable by root (check via ls -l, assign via chmod) and then have the following schedule in cron:
42 3-22 * * * /var/www/apache2-default/getUserDetails.php friend=14522828
After that, you can monitor /var/log/cron for commands being run by crond. And then you can check root's mail (mail
command) for the program output or errors encountered.
if on the other hand what you really had in your crontab was
0 2-21 * * * /www/file.php
Then I'm stumpped. The entry does look fine so what you need to make sure is that you can run the file manually in the command line (enter /www/file.php
in the shell). Add the execute bits for it if not executable.
After that, check /var/log/cron as well as root's mail for both commands being executed and errors.