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
DynamiteHost
Forum Commoner
Posts: 69 Joined: Sat Aug 10, 2002 5:33 pm
Post
by DynamiteHost » Fri Dec 13, 2002 9:54 am
Ok, I don't know where else to ask this question, so i'll ask you guys
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?
Johnm
Forum Contributor
Posts: 344 Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:
Post
by Johnm » Fri Dec 13, 2002 10:16 am
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 » Fri Dec 13, 2002 10:35 am
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
Johnm
Forum Contributor
Posts: 344 Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:
Post
by Johnm » Fri Dec 13, 2002 10:49 am
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 » Fri Dec 13, 2002 10:58 am
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 » Fri Dec 13, 2002 11:01 am
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.
Johnm
Forum Contributor
Posts: 344 Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:
Post
by Johnm » Fri Dec 13, 2002 11:04 am
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 » Fri Dec 13, 2002 11:15 am
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 » Fri Dec 13, 2002 11:25 am
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
JPlush76
Forum Regular
Posts: 819 Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:
Post
by JPlush76 » Fri Dec 13, 2002 1:00 pm
whoo hooo!
glad you got it workin