Browse files

Add Openshift cron job to call send-reminders

Also update the README accordingly.

Also, change the comment in to reflect the fact that the email
field *is* used by send-reminders. This ought to have been done when
send-reminders was written... oops.
  • Loading branch information...
zenhack committed Jan 10, 2016
1 parent b37a4bf commit af64fcf951749c0e87ca84801ef70ec19b313368
Showing with 37 additions and 10 deletions.
  1. +17 −0 .openshift/cron/daily/send-reminders
  2. +16 −6
  3. +4 −4 ironblogger/
@@ -0,0 +1,17 @@

# Openshift's "Cron" cartidge is substantially lighter on features than standard
# cron implementations; you can only specify daily, weekly, hourly, etc. You
# can't specify what time of day or what day of the week. So instead, we test on
# startup if it's the right day, and if not exit immediately.
# Setting LC_ALL is important, since otherwise the date command might return a
# name for the day of the week in a different language, which would break the
# condition:
if [ $(date +%A) != Friday ]; then

ironblogger send-reminders
@@ -117,19 +117,29 @@ manually and so there is a low risk of data corruption. To use postgres,
you'll need the additional python package `psycopg2`; read the comments
in `` to learn how to set that up.

## Syncing Posts & Bookkeeping
## Background Jobs

The recommended approach to keeping Iron Blogger's database up to date
is to add the `ironblogger sync` command described above to a cron job.
This must be run from the directory containing ``.
There are a few periodic tasks that Iron Blogger needs to be done. In

* New posts need to be downloaded and assigned to rounds (`ironblogger
* If weekly notification emails are desired, they must be sent
(`ironblogger send-reminders`).

All of these commands must be executed from the directory containing

The recommended approach is to put each of these in a cron job to
execute at the proper time.

## Openshift

Iron Blogger comes ready to run on [Openshift][6]. Have a look at
`` for instructions. You'll need the postgres
and cron cartridges installed. The scripts in the `.openshift` directory
will take care of keeping the database up to date (new posts will be
downloaded once per hour).
will take care of keeping the database up to date. New posts will be
downloaded once per hour, and reminders will be sent out on Fridays.

# License

@@ -83,12 +83,12 @@ class Blogger(db.Model):
# will take a bit of work.
name = db.Column(db.String, nullable=False, unique=True)
start_date = db.Column(db.DateTime, nullable=False)
email = db.Column(db.String)

# These aren't currently really used by anything (and aren't displayed
# publicly), but useful for an administrator to keep track of who people are when it comes time to
# collect debts:
# This isn't currently really used by anything (and isn't displayed
# publicly), but is useful for an administrator to keep track of who
# people are when it comes time to collect debts:
real_name = db.Column(db.String)
email = db.Column(db.String)

def __repr__(self):

0 comments on commit af64fcf

Please sign in to comment.