cronjob not working..
Hello, i tried to add a cronjob, but for some reason it isn't working...
I want the cronjob to be executed every minute. So i added this line to my crontab:
* * * * * /usr/bin/php /var/www/em/test.php
I also tried to run the test.php file from the terminal manually. And the php file executed correctly. So there's no error in the php file.
mysql_connect("localhost", "****", "****");
mysql_select_db("testdb01") or die(mysql_error());
$insert = "INSERT INTO test (msg) VALUES ('blaat')";
mysql_query ( $insert ) or die ( mysql_error() );
But the cron still isn't working... Anyone any idea what the problem might be..???
Check mail(1) for the user the cronjob is running as. By default, stdout/stderr from your cronjobs goes there.
I didn't specify any email anywhere for the cronjob, if that's what you need to know.
Depending on your distro there's most likely a mail-server set-up
for local delivery of mail. If you have mail, mailx, nail, mutt,
pine, ... installed you should be able to read notifications from
cron regarding the output of your script.
Also check the relevant log-files under /var/log (again, it all
depends on your distro ;} ... may want to add that to your profile!
grep -i cron /var/log/* for a first glimpse.
I don't have any mail server running, so i dont receive any mails with errors.
I checked the logs with the cmd you gave and this is what i got (its not eveything but i think its enough info):
It doesn't mean much to me, but maybe you can see any errors or something...
Oh, and i'm running the latest kubuntu (9.04).
Ok ... so *buntu have disabled local mail delivery; great :D
In that case, make it something like
I had the path wrong all the time cause it should've point to /var/www/em/test.php
But it works perfectly now :)
Thanks alot for you help!!
|All times are GMT -5. The time now is 09:24 PM.|