A Slight Mishap!

Visitors to the website over the past ~12 hours or so will have noticed... errors. Lots of errors!

My apologies.

I'm not sure if it was the second whisky-and-soda of the evening, but I was attempting to backup the website via a script. That was working well. But the script was then supposed to delete old backups -anything older than 14 days.

The script therefore used a variant of the Bash command:

find $BACKUPDIR -type f -mtime +14 -exec rm -f {} \;

Now that's a perfectly valid command and will do the deed nicely, in the context of a Bash script that is careful to set the variable BACKUPDIR to something sensible and meaningful. But what you don't want to do, especially after a couple of drinks, is copy that command out of the script and paste it into a terminal all by itself.

Because when you do that, you'll now be working in a context where BACKUPDIR is not set. And that means the command now says "find any files anywhere which are older than 14 days old and delete them". And it starts doing that in the root directory... at which point, your O/S is hosed and your server is now unbootable.

Like the icon says... oops!

So, I spent this morning re-installing a fresh O/S, re-installing Apache, MySQL, PHP and WordPress and then recovering things back to the status ante whisky. I believe that's all now proceeded successfully, so, welcome back. And sorry for trashing the website server in the first place!

As a result of the mishap, at least, I now realise my backup script was failing to backup two crucial configuration folders, so those have now been added to the script. If another bout of lunacy were to affect me in the future, I should be able to recover the website in the time it takes to re-install the operating system, plus 10 minutes. So there's that...

One thought on “A Slight Mishap!”

Comments are closed.