views:

49

answers:

1

I am designing a python web app, where people can have an email sent to them on a particular day. So a user puts in his emai and date in a form and it gets stored in my database.

My script would then search through the database looking for all records of todays date, retrive the email, sends them out and deletes the entry from the table.

Is it possible to have a setup, where the script starts up automatically at a give time, say 1 pm everyday, sends out the email and then quits? If I have a continuously running script, i might go over the CPU limit of my shared web hosting. Or is the effect negligible?

Ali

+3  A: 

Is it possible to have a setup, where the script starts up automatically at a give time, say 1 pm everyday, sends out the email and then quits?

It's surely possible in general, but it entirely depends on what your shared web hosting provider is offering you. For these purposes, you'd use some kind of cron in any version or variant of Unix, Google App Engine, and so on. But since you tell us nothing about your provider and what services it offers you, we can't guess whether it makes such functionality available at all, or in what form.

(Incidentally: this isn't really a programming question, so, if you want to post more details and get help, you might have better luck at serverfault.com, the companion site to stackoverflow.com that deals with system administration questions).

Alex Martelli
its a basic shared hosting environment. I can have shell access if I require, but no root access. They are running Apache on some flavour of linux which lets me set up a .htaccess file.Should I then simply ask them if they would let me run a cron file?
Ali
@Ali, yes, that's simplest -- unless you're specifically forbidden, a simple `crontab` entry will solve things for you most easily.
Alex Martelli
@Alex, but would that require a cron job for every minute? http://stackoverflow.com/questions/2732407/timed-email-reminder-in-python
Ali
@Ali, not at all, the cron job is simply set to run every day at 1pm.
Alex Martelli