Monday, November 26, 2007

Did you remove everything in the FreeBSD /usr/local/bin ?

Classic post again. This one is a boneheaded moment I had during an administration of my FreeBSD server. Since I learned from this mistake, many mistakes can be fixed on a nix based OS. Here you go.

Posted 2005-11-10

So I get an epiphany. I'll just write a script that manually deletes all of the trash out of my user's maildirs at a given time. So I was experimenting and decided to write a script that starts:

"rm -r /usr/home/*/Maildir/.Trash/cur/*"

that should do an rm -r in usr/home and the all of the users Maildir/trash/current folders.

I called it cleantrash and put it in /usr/local/bin.
I added it to the Crontab of the system to purge all trash at 3am.



Unfortunately I must have had a typo in the script. I must have written
"rm * -r /usr/home/*/Maildir/.Trash/cur/*"

because when I tested the script. I did an ls -l on /usr/local/bin


NOTHING ALL GONE

At least it isn't /usr/bin or even *gasp* /bin, but that was ALL of the binary files for all of my ports. (installed programs) Web didn't work, email didn't work...

Well just when I though all hope was lost, I figured I would rebuild portupgrade and try a portupgrade -faO.

Seemed to work at least partially. I couldn't access any of my php based hosted sites (including this one) and now I can. I HOPE this is the end of my bone-headedness. But at least with FreeBSD, almost anything can be fixed without a reimage of the whole os.

No comments: