Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 07-18-2004, 04:57 AM   #1
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
php question

i have a php script (page) that i want to be executed at every 12/24 hours.. how can i do so the script to be automaticaly executed at a fixed date from the day?
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 04:59 AM   #2
UltraSonic
Confirmed User
 
Join Date: Jul 2004
Location: UltraVirtuality
Posts: 1,728
Unix/Linux servers can execute it for you every 12/24 hours, whatever you choose.
__________________
Your Blend, Your Product

UltraSonic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 05:01 AM   #3
nolaman
Confirmed User
 
Join Date: Mar 2004
Location: New Orleans, LA
Posts: 1,001
cron
__________________
PHP Programmer ICQ 215-504-788
nolaman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 05:21 AM   #4
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
Quote:
Originally posted by UltraSonic
Unix/Linux servers can execute it for you every 12/24 hours, whatever you choose.
how do i do that?

let's say that the php script is located at /home/script.php
can somebody explain me exactly what i have to do so the script.php to be automaticaly executed at a fixed hour each day?
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 05:27 AM   #5
fishy
Confirmed User
 
Join Date: Jul 2004
Posts: 116
Teach a monkey to type in the text, then give the monkey a big banana every 12/24 hours. Don't make it sign any agreements, don't know if it will agree to do that. I know these monkeys drive a hard bargain...
fishy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 05:32 AM   #6
budz
Disruptive Innovator
 
budz's Avatar
 
Industry Role:
Join Date: Sep 2003
Location: Vegas
Posts: 4,230
Quote:
Originally posted by fishy
Teach a monkey to type in the text, then give the monkey a big banana every 12/24 hours. Don't make it sign any agreements, don't know if it will agree to do that. I know these monkeys drive a hard bargain...
lmao.
__________________
C:\Code\
C:\Code\Run\
budz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 05:35 AM   #7
Calvinguy
Confirmed User
 
Join Date: Oct 2002
Location: European Union
Posts: 1,752
Ask your host
Calvinguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 05:48 AM   #8
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
Quote:
Originally posted by Calvinguy
Ask your host
i'm on dedicated
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 06:12 AM   #9
Manowar
jellyfish  
 
Join Date: Dec 2003
Posts: 71,528
Quote:
Originally posted by fishy
Teach a monkey to type in the text, then give the monkey a big banana every 12/24 hours. Don't make it sign any agreements, don't know if it will agree to do that. I know these monkeys drive a hard bargain...
Manowar is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 06:24 AM   #10
UltraSonic
Confirmed User
 
Join Date: Jul 2004
Location: UltraVirtuality
Posts: 1,728
Quote:
Originally posted by alex79
how do i do that?

let's say that the php script is located at /home/script.php
can somebody explain me exactly what i have to do so the script.php to be automaticaly executed at a fixed hour each day?
Make a cronjob that executes every 12/24 hours........ how to do it: RTFM (yahoo: +howto +cron) or install webmin.
__________________
Your Blend, Your Product

UltraSonic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 06:25 AM   #11
Ash@phpFX
Confirmed User
 
Join Date: Nov 2003
Posts: 4,292
make a cron job,

or hit f5 twice a day
Ash@phpFX is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 06:30 AM   #12
UltraSonic
Confirmed User
 
Join Date: Jul 2004
Location: UltraVirtuality
Posts: 1,728
Maybe this helps:

Example Crontab:

# r----minute
# | r-----hour
# | | r------day of the month
# | | | r------month
# | | | | r------day of the week
# | | | | | |------ command to run ------------->
# | | | | | |
5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
# run five minutes after midnight, every day
15 14 1 * * $HOME/bin/monthly

# run at 2:15pm on the first of every month -- output mailed to paul
0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%

# print out the message at 4:05 every sunday.
5 4 * * sun echo "run at 5 after 4 every sunday"





If this file were saved as "paul.ct" then


crontab -u paul paul.ct

would be used to store the crontab for the user paul.

For more information:
man cron
man crontab
man 5 crontab


If it doesn't help..... back to yahoo and howtos
__________________
Your Blend, Your Product

UltraSonic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 07:54 AM   #13
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
if i type this line from ssh
php /home/script.php > /dev/null
the script.php is executed

but if i write this line in crontab:

* * * * * php /home/script.php > /dev/null
or

30 7 * * * php /home/script.php > /dev/null

is not executed..
what can be the problem?
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 08:00 AM   #14
Repetitive Monkey
Confirmed User
 
Join Date: Feb 2004
Posts: 3,505
Use wget instead and specify the external address.
Repetitive Monkey is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 08:09 AM   #15
UltraSonic
Confirmed User
 
Join Date: Jul 2004
Location: UltraVirtuality
Posts: 1,728
Quote:
Originally posted by alex79
if i type this line from ssh
php /home/script.php > /dev/null
the script.php is executed

but if i write this line in crontab:

* * * * * php /home/script.php > /dev/null
or

30 7 * * * php /home/script.php > /dev/null

is not executed..
what can be the problem?
Might be because you have to restart the crontab i think
__________________
Your Blend, Your Product

UltraSonic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-18-2004, 09:49 AM   #16
Stramm
Confirmed User
 
Join Date: Jan 2003
Location: NL
Posts: 342
Quote:
Originally posted by UltraSonic
Might be because you have to restart the crontab i think
restart crontab???? huh??


that works
30 1 * * * /usr/local/bin/wget --spider -q http://www.yourdomain.com/path/script.php >/dev/null 2>&1

the path top wget you can get with 'whereis wget' (SSH or telnet)

if it's htaccess/ htpasswd protected... then http://user:[email protected]/path/script.php ....
Stramm is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-19-2004, 05:19 AM   #17
rich06
Registered User
 
rich06's Avatar
 
Industry Role:
Join Date: May 2004
Posts: 20
alex

you shouldn't need to re-start cron -- it re-loads all crontab changes automatically.

The reason your crontab entry didn't run was probably because cron couldn't find the php binary ... try again with the full path to your php binary e.g.

* * * * * /usr/bin/php -q /home/script.php > /dev/null 2>&1

hth
rich
__________________
Email: [email protected]
rich06 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-19-2004, 07:33 AM   #18
arachnO
Confirmed User
 
arachnO's Avatar
 
Industry Role:
Join Date: Jan 2004
Location: Cyprus
Posts: 1,327
crontab is your solution...
arachnO is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.