Jump to content

Archived

This topic is now archived and is closed to further replies.

Seamless

Cron Jobs

Recommended Posts

Hi There,

i wonder if anyone can help me....

i have some php scripts in a directory on my web server and want them to run and specific times using a cron tab. I thought i had set them up correctly but the email confirmation it sends when it performs a cron says:

/bin/sh: line 1: /home/my-username/public_html/my-website/crons/check-links.php: Permission denied

what am i doing wrong?

can anyone shed some light on it.

Thanks in advance

Seamless.

Share this post


Link to post
Share on other sites
Check the permissions on the PHP scripts you're trying to run. Make sure other scripts have the ability to run them (or use chmod 777 on them just to be safe).

Share this post


Link to post
Share on other sites
[!--quoteo(post=372287:date=May 8 2006, 10:16 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ May 8 2006, 10:16 AM) [snapback]372287[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Check the permissions on the PHP scripts you're trying to run. Make sure other scripts have the ability to run them (or use chmod 777 on them just to be safe).
[/quote]
If Ober's answer doesn't, check with your ISP. Many ISP's disable user crons, but when talked to nicely will set individual ones up foryou.

Share this post


Link to post
Share on other sites
[!--quoteo(post=372296:date=May 8 2006, 10:36 AM:name=Lofty)--][div class=\'quotetop\']QUOTE(Lofty @ May 8 2006, 10:36 AM) [snapback]372296[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If Ober's answer doesn't, check with your ISP. Many ISP's disable user crons, but when talked to nicely will set individual ones up foryou.
[/quote]

I've set chmod on all my cron file to 777 and i am now getting different errors:

/home/my-username/www/my-website/crons/check-links.php: line 1: ?
: No such file or directory
/home/my-username/www/my-website/crons/check-links.php: line 2:
: command not found
/home/my-username/www/my-website/crons/check-links.php: line 3: =: command not found
/home/my-username/www/my-website/crons/check-links.php: line 3:
: command not found
/home/my-username/www/my-website/crons/check-links.php: line 4: =: command not found
/home/my-username/www/my-website/crons/check-links.php: line 4:
: command not found
/home/my-username/www/my-website/crons/check-links.php: line 5: =: command not found
/home/my-username/www/my-website/crons/check-links.php: line 5:
: command not found
/home/my-username/www/my-website/crons/check-links.php: line 6: =: command not found
/home/my-username/www/my-website/crons/check-links.php: line 6:
: command not found
/home/my-username/www/my-website/crons/check-links.php: line 7:
: command not found
/home/my-username/www/my-website/crons/check-links.php: line 9: syntax error near unexpected token `('
/home/my-username/www/my-website/crons/check-links.php: line 9: `$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd") or die ("Couldn't connect to server.");
'

The files are php, and if i access them via a browser they work correctly that way, am i doing something else wrong?

Thanks

Seamless

Share this post


Link to post
Share on other sites
[!--quoteo(post=372574:date=May 9 2006, 08:29 AM:name=v3x)--][div class=\'quotetop\']QUOTE(v3x @ May 9 2006, 08:29 AM) [snapback]372574[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Dumb question but how do you make it execute a PHP script?
[/quote]

well after some research i'm entering this into my cron settings via cpanel:

curl -s -o /dev/null [a href=\"http://www.my-website.com/crons/check-links.php\" target=\"_blank\"]http://www.my-website.com/crons/check-links.php[/a]

i'm not getting an email now saying there is an error, so can i assume that as long as the php script is correct its doing its job?

Seamless.

Share this post


Link to post
Share on other sites
yes. unless it's not running at all. like, you somehow disabled it instead. does your script update a table? go to phpmyadmin and see if the table is being updated.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.