Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

S Ahmad
S Ahmad
228 Points

How to load Python Code to a server?

Hi Guys,

I'm fairly competent with Python but I've never 'uploaded code' to a server before and have it run automatically.

I'm working on a project that would require some code to be running 24/7. At certain points of the day, if a criteria is met, a process is started. For example: a database may contain records of what time each user wants to receive a daily newsletter (for some subjective reason) - the code would at the right time of day send the newsletter to the correct person. But of course, all of this is running out on a Cloud.

Any help would be appreciated - even correcting my entire formulation of the problem! If you know how to do this in any other language - please reply with your solutions!

Thanks Guys!

2 Answers

Alan Johnson
Alan Johnson
7,625 Points

Hi Sohalb! It sounds like what you're wanting is a cron job. Here's the documentation for crontab, the way you configure cron jobs on Linux and Unix servers.

Basically, with a cron job you can kick off a new process up to every minute. When that process starts, you would check the database to see what newsletters need to be sent, and then you'd send them.

I hope that helps! Let me know if you have any additional questions.

S Ahmad
S Ahmad
228 Points

Thanks Alan!