On Sun, Jul 20, 2003 at 11:43:20PM -0500, Dan Nelson wrote:
> > For example user1 has a web space in /home/hostings/user1 and his
> > database in /home/hostings/user1/data and user2 will have his web
> > space in /home/hostings/user2 and database in
> > /home/hostings/user2/data
> Create symlinks from the mysql data dir to each user's directory:
> /var/db/mysql/user1 -> /home/hostings/user1/data
> /var/db/mysql/user2 -> /home/hostings/user2/data
> etc. Then any table the user creates in their database will end up in
> their data dir.
That'll put the files in the right directories, but if the quotas are
based on file ownership, it won't limit the users' database size, since
mysql wants the tables and indices to be owned by the 'mysql' user.
After some searching and cogitating on the matter, I gave up trying to
figure out an elegant solution, and now have a cron job running once a
day that adjusts the user's filesystem quota to the an amount calculated
by subtracting the sum of the sizes of their database files from the
quota they've purchased according to my customer database.
It doesn't protect us completely -- a customer could still allow their
database to grow beyond quota -- but at least we're semi-protected, and
we won't screw up a database by refusing to write to its files. And of
course, there's another cron job that disables the customer's web site
if he's over-quota for more than one week. So far, that's been hit only
once, and the customer deleted the "backup of his home computer" stored
in the database within hours of the site going down. ;-)
Ah, those wacky file upload toys....
Paul Chvostek <paul@stripped>
Operations / Abuse / Whatever
it.canada, hosting and development http://www.it.ca/