Simple Machines Community Forum

General Community => Scripting Help => Topic started by: umiya on September 16, 2004, 11:42:40 PM

Title: Cron jobs
Post by: umiya on September 16, 2004, 11:42:40 PM
Im trying to creat one on my  site and i cant get the darn thing to work

this is what i have in the command line

/usr/bin/php rpg/turns.php

anyone have any ideas for me?
Title: Re: Cron jobs
Post by: [Unknown] on September 16, 2004, 11:58:05 PM
You have to give the full path to rpg/turns.php.  For example:

/home/umiya/public_html/rpg/turns.php

I think you might also have to use -f, like:

/usr/bin/php -f /home/umiya/public_html/rpg/turns.php

Another method (sometimes better) is to use wget, like so:

wget -q -O - http://www.yourdomain.tld/rpg/turns.php

-[Unknown]
Title: Re: Cron jobs
Post by: Parham on September 17, 2004, 12:20:38 AM
the php program also needs the shebang line in it because your running it from the shell

#!/usr/local/bin/php (or wherever it is)

if you use wget, you won't need the shebang line in it though...
Title: Re: Cron jobs
Post by: umiya on September 17, 2004, 12:26:09 AM
wget -q -O - http://www.yourdomain.tld/rpg/turns.php

ill try this and post update :)
Title: Re: Cron jobs
Post by: [Unknown] on September 17, 2004, 12:27:47 AM
Quote from: Parham on September 17, 2004, 12:20:38 AM
the php program also needs the shebang line in it because your running it from the shell

#!/usr/local/bin/php (or wherever it is)

if you use wget, you won't need the shebang line in it though...

Actually, that's only if you +x it and try to run it directly.  If you call it with /usr/bin/php, it doesn't need the shebang.

-[Unknown]
Title: Re: Cron jobs
Post by: umiya on September 17, 2004, 12:40:24 AM
tried it and this is what i got in email

bin/sh: line 1: /usr/bin/wget: Permission denied


lol i jsut noticed something

does

wget -q -O - http://www.yourdomain.tld/rpg/turns.php

the part in bold have to be there?
Title: Re: Cron jobs
Post by: [Unknown] on September 17, 2004, 12:46:48 AM
Actually, www.yourdomain.tld was an example.  The tld stands for "top level domain", which is like .com, .org, etc.  Here, that part would be www.simplemachines.org.  No tld ;).

You don't seem to have permission from your host to use wget.... that kinda sucks.  You might want to ask them why this is, but maybe using php directly will be better.  You can also try the "fetch" command, or "curl" - if those aren't denied.

-[Unknown]
Title: Re: Cron jobs
Post by: umiya on September 17, 2004, 01:22:58 AM
well heres what i jsut tried

/usr/bin/php -f /infinite/public_html/rpg/turns.php

and this is what i got back


No input file specified.

Title: Re: Cron jobs
Post by: [Unknown] on September 17, 2004, 01:35:10 AM
Are you sure it's not /home/infinite?  Remember, this is your FULL path, not relative to your website or your FTP.

-[Unknown]
Title: Re: Cron jobs
Post by: umiya on September 17, 2004, 01:49:04 AM
/usr/bin/php -f home/infinite/public_html/rpg/turns.php
 

No input file specified.


still not working :(
Title: Re: Cron jobs
Post by: [Unknown] on September 17, 2004, 01:50:31 AM
Try it with the first / - /home/...

-[Unknown]
Title: Re: Cron jobs
Post by: umiya on September 17, 2004, 01:53:33 AM
/usr/bin/php -f /home/infinite/public_html/rpg/turns.php

like so?

edit- whooooo hooooo thank you so much that did it :)