You should be able to use 'find' on the directory and search by UNIX atime
(atime is updated whenever the database is accessed, be it a read or a
write). `find . -atime ...` man find for more details.
>From there, it's a simple shell script
On Thu, 12 Apr 2001, Gary Huntress wrote:
> I have been offering free hosting of MySQL databases at freesql.org for the
> last few weeks. As a result I now have several hundred databases (which I
> think is great!), with a subset (perhaps 50) that are in active use. I
> would like to implement a policy where I can cull dormant or otherwise
> abandoned databases. Empty ones are easy, I can check the file dates in
> ~/mysql/data/whatever, and delete if there are no tables after 30 days or
> so. Databases with empty tables are similarly easy too.
>
> My problem is the case where a user creates a database, creates a table and
> adds data. I did not realise that the file date reported by ls -l is not
> updated unless the user inserts or updates. If the user has relatively
> static data and is only using selects, then that date will remain "old" and
> thus I cannot trust it to identify unused databases.
>
> What is the best (or a better) way to identify these abandoned databases?
> Each database has exactly one authorized user so I was considering starting
> mysqld with --log, and then writing a script to parse the logfile, but that
> seems inelegant. Is there an easier way to identify the last time a user
> connected to a database?
>
>
> Regards,
> Gary "SuperID" Huntress
> =======================================================
> FreeSQL.org offering free database hosting to developers
> Visit http://www.freesql.org
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php