Page 1 of 1

Help with cron task command...

Posted: Fri Dec 13, 2002 9:54 am
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?

Posted: Fri Dec 13, 2002 10:16 am
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

Posted: Fri Dec 13, 2002 10:35 am
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

Posted: Fri Dec 13, 2002 10:49 am
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

Posted: Fri Dec 13, 2002 10:58 am
by DynamiteHost
I'm on Linux Red Hat.

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

The file is a php file

Posted: Fri Dec 13, 2002 11:01 am
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.

Posted: Fri Dec 13, 2002 11:04 am
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

Posted: Fri Dec 13, 2002 11:15 am
by DynamiteHost
JPlush76, can I use that via CPanels "cron tasks" feature?

Johnm, yes :)

Posted: Fri Dec 13, 2002 11:25 am
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

Posted: Fri Dec 13, 2002 12:57 pm
by DynamiteHost
YES!

Thank you, it worked :D

Posted: Fri Dec 13, 2002 1:00 pm
by JPlush76
whoo hooo! :)

glad you got it workin