You could always change your links to use an outgoing page like:
mydomain.com/goodbye.php?url=abcd
Then your goodbye.php does your housecleaning, and after it's done, just shuffles them off to whatever URL they want (as specified by the $_GET variable "url").
Otherwise, you could always just use a cron job to run every hour or every 1/2 hour depending upon your need.