[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Hosting control panel



On Mon, Nov 27, 2006 at 03:07:41PM +0100, Jan Wagner wrote:
> On Monday 27 November 2006 14:23, Ward Vandewege wrote:
> > Yeah, that's what I do for the most part. It also has the benefit
> > that if your database server goes down (for whatever reason), your
> > MTA is not affected.
>
> Okay .. but your scripts need to make shure thats the files are only
> written, if the database is reachable and sends usesfull data. :)

good advice and easy to do.

you need to make it an atomic operation, anyway as is good practice when
updating any postmap-able file. you do that by generating a tmp file and
only mv-ing it into place if everything's OK.



btw, it's also useful to only update the postmap file IF the database
has changed (in order to avoid making postfix reload its maps
unneccessarily). that's easy to do with postgres, because you can set
up a trigger to update a timestamp whenever a database record changes
(UPDATE, DELETE, or INSERT), then check the timestamp before you
regenerate the map files. mysql doesn't do triggers.

this is analagous to using a Makefile to ONLY perform some action
(compile a program, postmap a source text file, move or copy files
around, etc) if any depended-upon file has changed.


BTW...yes, i've done exactly this in the past. it works quite nicely.
sql database for managing user records, ultra-fast hashed db files
for postfix, and the mail system keeps on working if the sql db is
unreachable for any reason (i like sql databases, but i don't like
making mail systems depend directly on them).

think of it as caching the user data from the sql db in a hashed db file.


craig

-- 
craig sanders <cas@taz.net.au>           (part time cyborg)



Reply to: