GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   php question (https://gfy.com/showthread.php?t=327590)

alex79 07-18-2004 04:57 AM

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?

UltraSonic 07-18-2004 04:59 AM

Unix/Linux servers can execute it for you every 12/24 hours, whatever you choose.

nolaman 07-18-2004 05:01 AM

cron

alex79 07-18-2004 05:21 AM

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?

fishy 07-18-2004 05:27 AM

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...

budz 07-18-2004 05:32 AM

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.

Calvinguy 07-18-2004 05:35 AM

Ask your host

alex79 07-18-2004 05:48 AM

Quote:

Originally posted by Calvinguy
Ask your host
i'm on dedicated :(

Manowar 07-18-2004 06:12 AM

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...
:1orglaugh

UltraSonic 07-18-2004 06:24 AM

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.

Ash@phpFX 07-18-2004 06:25 AM

make a cron job,

or hit f5 twice a day :1orglaugh

UltraSonic 07-18-2004 06:30 AM

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 :)

alex79 07-18-2004 07:54 AM

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?

Repetitive Monkey 07-18-2004 08:00 AM

Use wget instead and specify the external address.

UltraSonic 07-18-2004 08:09 AM

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

Stramm 07-18-2004 09:49 AM

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 ....

rich06 07-19-2004 05:19 AM

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

arachnO 07-19-2004 07:33 AM

crontab is your solution...


All times are GMT -7. The time now is 05:17 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123