cron job randomly once a day

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
lucker
Forum Newbie
Posts: 2
Joined: Sat Oct 30, 2010 7:03 pm

cron job randomly once a day

Post by lucker »

I want to create a cron job randomly once a day for my site's registration.
The responsible file for registrations is a config file and I need to change the contents though a php file
twice on day (on and off)
I know the way for random cron job for example
*/n * * * * /usr/local/bin/php /home/user/domain.com/cron.php >/dev/null 2>&1(registrations on)
but i don't know how to change the values after one hour to normall (registrations off)..
Any suggestions on this>??
Sorry for my bad English
Thank you in advance
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: cron job randomly once a day

Post by josh »

write a php script to do the randomization and call it every hour
lucker
Forum Newbie
Posts: 2
Joined: Sat Oct 30, 2010 7:03 pm

Re: cron job randomly once a day

Post by lucker »

I trying this to opening registrations..
How can edit to close registrations after 1 hour
Thank you in advance
<?
set_time_limit(0);
sleep(rand(0, 86400));
/*
my spesify code here
*/

?>
Post Reply