rm -r is dangerous
by jcf. Average Reading Time: less than a minute.
Uh oh.
Executing rm -r with root permission is dangerous (as others, unnamed persons know). Luckily not in / and not on a production server.
Learn this lesson: When testing scripts that delete files, do an echo instead of a rm until you are sure, that you are in the right path.
Waiting for the restore crew…
Update: The directory is back – time to leave for the weekend, I guess.

We probably all have stories to tell. Mine involved typing “cd bin” immediately followed (without looking) by “rm -r *”, only to then look up and note in horror that I had really typed “cd bon” instead of “cd bin”. I had been sitting at the top of the source tree for a massive project at the time, intending to delete all binaries before a rebuild, but since there was no “bon” directory, I was still in the top level directory, so the entire source tree was deleted! Aargh1
-rich
The directory is almost restored now ;-) (They found the guy that handles backups / restores and he finally returned from lunch).
The worst thing I ever did (back in my youg days) was to find stuff to delete on a Notes OS/2 server (version 2.1 – I’m dating myself).
So I cd into the datadirectory and do a lot of “dir *.nsf” to find stuff to delete. Only at one time I hit “del *.nsf”.
Luckily the most important databases were opened by users, so the server had them locked…
Unnamed? /me looks around and slowly walks away ;)
Lesson learned: Always check the content of a variable which you use to make persistant changes to a filesystem with. Especially if that code is a mod_perl thingy which is triggered by a section in your httpd.conf and thus runs as… right, root.
Kids, don’t try this at home or the production box :)