Jump to content


Photo

Cron Jobs


  • Please log in to reply
6 replies to this topic

#1 Seamless

Seamless
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 08 May 2006 - 02:46 PM

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.

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 08 May 2006 - 03:16 PM

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).

Info: PHP Manual


#3 dtc

dtc
  • New Members
  • Pip
  • Newbie
  • 7 posts
  • LocationDevon, England

Posted 08 May 2006 - 03:36 PM

[!--quoteo(post=372287:date=May 8 2006, 10:16 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ May 8 2006, 10:16 AM) View Post[/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.

#4 Seamless

Seamless
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 09 May 2006 - 10:27 AM

[!--quoteo(post=372296:date=May 8 2006, 10:36 AM:name=Lofty)--][div class=\'quotetop\']QUOTE(Lofty @ May 8 2006, 10:36 AM) View Post[/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

#5 Brandon Jaeger

Brandon Jaeger
  • Members
  • PipPipPip
  • Advanced Member
  • 155 posts
  • LocationPA
  • Age:25

Posted 09 May 2006 - 01:29 PM

Dumb question but how do you make it execute a PHP script?
PHP is my friend (=

#6 Seamless

Seamless
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 10 May 2006 - 09:14 AM

[!--quoteo(post=372574:date=May 9 2006, 08:29 AM:name=v3x)--][div class=\'quotetop\']QUOTE(v3x @ May 9 2006, 08:29 AM) View Post[/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.

#7 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 11 May 2006 - 08:54 AM

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.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users