Serendipity (s9y) database maintenance script

I created a simple database maintenance script s9_cleandb_sh for s9y database tables. You can find it on github.

Here is the background (see also README file):

Some database tables in serendipity tend to become very big with time. This is especially the case for logging only tables like spamblocklog and visitors.

The problem seems to be well known.

There exists an alpha version of a plugin  and a feature request for the admin panel but the changes did not appear in spartacus or the mainline code

However I use the very simple approach to just call an external shell script to delete all entries older than a given date.

To use it:

  • Place it in /usr/local/sbin
  • Create a MySQL client config file my_cnf_dbclean with database, user and password information:
    [client]
    database=your_s9y_dbname
    user=your_s9y_db_username
    password=your_s9y_db_password
  • And add the call /usr/local/sbin/s9y_cleandb.sh /path/to/my_cnf_dbclean e.g to /etc/cron.weekly/s9y_cleanup

I call it weekly, so that I don’t get annoyed by daily cron mail output, but can keep an eye on it on the other hand. Hopefully s9y soons gets an automated time based database maintenace mechanism…