Cron Job problem

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Cron Job problem

Post by itsmani1 »

My files are located at:

/home/outsourcingi/public_html/includes/updates.php

I want to run cron job every 5 minutes on it. i don't know how can i do this?

Current setup:

Code: Select all

*/5 * * * * /home/outsourcingi/public_html/includes/updates.php

Output Email:
/home/outsourcingi/public_html/includes/updates.php: line 1: ?PHP: No such file or directory
/home/outsourcingi/public_html/includes/updates.php: line 2: syntax error near unexpected token `'dizyn@hotmail.com','test','test message...''
/home/outsourcingi/public_html/includes/updates.php: line 2: ` mail('dizyn@hotmail.com','test','test message...');'

Any solution....

Regards,
dizyn
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Cron Job problem

Post by VladSun »

You should use

Code: Select all

php -q /path/to/your/file.php
to execute a PHP file in shell.

Or you may try adding at the top of your php file the line:

Code: Select all

#!/usr/bin/php
although I'm not sure it will work.
http://en.wikipedia.org/wiki/Shebang_(Unix)
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply