That's still quite laborious. How about changing that cron job to a
simple chmod command.
Hmm.... can't help, still think my way is cleaner, easier to automate and
therefore less prone to errors - not to mention /less/ laborious in the
long run. No manual messing with cron.tab. Just to show you such a script
is not too complicated, here's an example in python (not tested, very
probably has some errors):
import string
import random
import time
import sys
def makeLink():
"returns the hash from which to create the link of form
getBook.py?hash=..."
hash = ''.join([random.choice(string.ascii_uppercase) for i in
range(32)]);
f = open('hash.db','a')
f.write(hash+' '+`time.time()`)
f.close()
return hash
def get(hash):
"when the script is called with an actual hash, call this func to check
if it's a valid one"
db = dict([line.split() for line in open('hash.db')])
try:
assert time.time()-db[hash] < 3600*24*7
sys.out.write('content-type:
application/x-pdf\n\n'+open('theBook.pdf').read())
except KeyError, AssertionError:
sys.out.write('content-type: text/plain\n\nInvalid or expired hash.')
Now for a real, running script of course you'd want to fancy it up a bit,
but the above few lines generally cover all of idea.