set -eu; set -o pipefail
The key missing one in this case was `-u`. That stops the script if you have an unset variable.This script would do some stuff, and put a new website in place, and then remove the old one. So, my bash script had the line:
rm -rf /var/www/$olddir
You can see it already. I ran it with $olddir unset. I think I had it in my head that the directory would simply not be found so that was fine. For those of you unfamiliar with bash, since olddir="", what actually ran was: rm -rf /var/www/
Gigabytes lost (back then, a GB was a lot!). We had backups but they took hours to restore. Horrible, horrible day.