#!/bin/sh
#
#  This script is designed to dump all the MySQL databases upon
# the local system.
#

set -e

for db in mysql postgres ; do

  if [ -d /var/backups/$db ] ; then
    #
    # The -P option causes find never to follow symlinks -- this is the default
    # behaviour for find, but best have it in, just in case.
    #
    # This deletes *.sql, and *.gz 
    # add the sql extension to the dump.
    #
    find -P /var/backups/$db -type f -mtime +7 -regex '^.*\(\.sql\|\.gz\)$' -regextype posix-basic 
  fi

done

exit 0
