disaster recovery - did I do the right thing?

Ray ray at stilltech.net
Sun May 6 04:34:59 UTC 2007


On Saturday 05 May 2007 9:23 pm, Martin Tournoij wrote:
> On Sat 05 May 2007 18:05, Garrett Cooper wrote:
> > Martin Tournoij wrote:
> > >On Sat 05 May 2007 17:05, Ray wrote:
> > >>Hello all,
> > >>I did something stupid the other day (sleep deprivation combined with a
> > >> "clever" hack were the main reasons), and I'm just curious if I did
> > >> the right thing afterwards.
> > >>
> > >>The mistake:
> > >>/usr/local/# rm -f *
> > >>note that root was running bash as a shell at the time, found in
> > >> /usr/local/bin or something.
> > >>
> > >>What I did was to start over, reinstall from scratch.
> > >>my question, was there an easier way?
> > >>thanks,
> > >>Ray
> > >
> > >You can use pkg_info -ga to check for missing files in your packages.
> >
> > For (t)csh:
> > alias rm "rm -i"
> >
> > For (ba)sh:
> > alias rm="rm -i"
> >
> > Now that you've learned :).
> >
> > Martin's suggestion is good though -- would have done that considering
> > that all that lived in /usr/local were ports.
> >
> > -Garrett
>

Thanks, I'll keep that in mind, but there had better not be a next time. 
(anybody have a source for one of those nice white jackets with the really 
long sleeves, just in case? ;)       )

> The problem with this is that it will ask confirmation for every file it
> deleted.
> Which is gets pretty annoying after a while, also, if you delete a
> directory containing a 100 files, you will have to press 'y' a 100
> times.
> This will probably lead to the habit of using 'rm -f', and/or simply
> pressing y all the time without actually looking at the confirmation
> message.
> In any case, it's not likely to prevent any such accidents.
>
> A better solution would be to write a script that would move files
> instead of deleting them.
> You should name this script to something else than rm, when you're
> working with a new or "foreign" system, you will expect rm to move
> files, instead of deleting them ... and we can all see another
> disaster coming there...
>
> Another hint would be the 'rmstar' option in tcsh, when set, tcsh will
> ask confirmation before executing 'rm *'.
>
> Note that aliasing 'cp' and 'mv' to 'cp -i' and 'mv -i' is an
> *extremely* wise idea, in the past I have often accidentally overwritten
> files that should not have been overwritten, leading to various
> problems.
>

good ideas, and I may use some of them,
but wouldn't have helped in this case. I _wanted_ to erase all the files in 
this directory (I thought). Due to a softlink and name confusion (a "clever" 
hack) I wasn't in the directory I thought I was.
You live, you learn.
Ray

>-- 
>Regards,
>Martin Tournoij
>_______________________________________________
>freebsd-questions at freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-questions
>To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"




More information about the freebsd-questions mailing list