Help with cron task command...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DynamiteHost
Forum Commoner
Posts: 69
Joined: Sat Aug 10, 2002 5:33 pm

Help with cron task command...

Post by DynamiteHost »

Ok, I don't know where else to ask this question, so i'll ask you guys :D

I just want to execute a file once a day. All I need is the command as I know how to setup the date...

how do I do the execute bit?
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

Just as you would from a shell. Give it the path and name of what you want to execute.
EX: /usr/bin/shellscript_that_does_what_I_want.sh


John M
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

1. are you on a unix box?

2. are you familiar with setting up a crontab?

3. do you have the file you want to use set up as an executable?

4. do you have the path to the language you're going to use? IE: !#/bin/sh
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

We run SGI's version of Unix along with several versions of Linux and HP unix.

I have set up a few cron jobs.

You call an exe the same way and as long as it is compiled it should work.
Something like the path to shell should be the first line in the script. (!#/bin/sh)


John M
DynamiteHost
Forum Commoner
Posts: 69
Joined: Sat Aug 10, 2002 5:33 pm

Post by DynamiteHost »

I'm on Linux Red Hat.

I don't have any knowledge of shell commands...

The file is a php file
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

at the unix command line you can use the "LYNX" browser to execute your PHP script. It act like someone clicking they're browser on the page just when you want them to.

crontab -e

type in:

0 5 * * * lynx -dump http://www.yourwebsite.com/yourscript.php


thats about all there is to it :)
let me know if you have trouble with that one.
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

Woops,
My reply was confusing because I wasn't paying attention to who was posting what.
Sorry.

DynamiteHost,

Do you have php installed in a manor that cron can use it? (as a stand alone)

John M
DynamiteHost
Forum Commoner
Posts: 69
Joined: Sat Aug 10, 2002 5:33 pm

Post by DynamiteHost »

JPlush76, can I use that via CPanels "cron tasks" feature?

Johnm, yes :)
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

if you dont have direct access to a command line on your server. then yea you can use that.

let us know if it works out ok for ya
DynamiteHost
Forum Commoner
Posts: 69
Joined: Sat Aug 10, 2002 5:33 pm

Post by DynamiteHost »

YES!

Thank you, it worked :D
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

whoo hooo! :)

glad you got it workin
Post Reply