View Single Post
Old 07-09-2008, 09:19 AM  
Babaganoosh
♥♥♥ Likes Hugs ♥♥♥
 
Babaganoosh's Avatar
 
Industry Role:
Join Date: Nov 2001
Location: /home
Posts: 15,841
Quote:
Originally Posted by Dido AskJolene View Post
Actually, that still leaves the chance that your script will never, ever execute.
Try just cronning your script once and having your script sleep for a randomized number of seconds.
That way, it will run, you just won't be certain when

(By the way, shells by default don't have a random number generator as far as I know. You might have to find yourself a random number "program" for that)
That's kinda true. I didn't really read his post. There's still a simpler way to do this.

Generate a random number between 1-6. Store that along with the date in a flat file. When the script runs, have it choose a number between 1-6. If that = the random number then execute the script.

You'd have to keep track of the numbers already picked for the day as well as increment the date after the script has already run for the day. Make sure the script doesn't execute again if the date in the text file == today.
__________________
I like pie.
Babaganoosh is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote