Live data from Hacker News

The day I locked everyone out of the company intranet

dancowell.com

121–130 of 130 posts

Re: The day I locked everyone out of the company intranet

#121
post #23

Earlier quoted context omitted.

Once I wanted to do `rm -fr *~` to delete backup files, but the `~` key didn't register... Now I have learnt to instinctively stop before doing anything destructive and double-check and double-check again! This also applies to SQL `DELETE` and `UPDATE`! I know that `-r` was not neccessary but hey that was a biiiig mistake of mine!

One time I was debugging the path resolver in a static site generator I was writing. I generated a site ~/foo, thinking it would do /home/shantaram/foo, but instead it made a dir '~' in the current directory. I did `rm -rf ~` without thinking. Command took super long, wondered what was going on, ctrl-c'd in horror... that was fun.

I’m really curious: without cheating by using the GUI, what would be the proper way to delete such an obnoxiously-named directory? Would “$PWD/~” work?

Re: The day I locked everyone out of the company intranet

#122
post #39

Earlier quoted context omitted.

In the late 90’s I wanted to try this Linux thing, so I followed a tutorial. First step: fdisk Yes, that was my Windows partition going bye-bye.

So... success? ;)

I mean, he arguably did F the Disk, sounds correct

Re: The day I locked everyone out of the company intranet

#123
post #121

Earlier quoted context omitted.

One time I was debugging the path resolver in a static site generator I was writing. I generated a site ~/foo, thinking it would do /home/shantaram/foo, but instead it made a dir '~' in the current directory. I did `rm -rf ~` without thinking. Command took super long, wondered what was going on, ctrl-c'd in horror... that was fun.

I’m really curious: without cheating by using the GUI, what would be the proper way to delete such an obnoxiously-named directory? Would “$PWD/~” work?

A few ways.

rm ./~ is likely the easiest.

Another option, shell dependent, would be to turn off shell globbing.

The `GNU` version of `find` has a `-maxdepth` option so

find . -iname '~' -maxdepth 1 -exec rm {} \;

would work, but I don't like relying on `GNU` extensions.

Re: The day I locked everyone out of the company intranet

#124

Decades ago my ex colleague was supposed to enter a command handwritten on a piece of paper saying "rm -rf /var/log/blah/ " which she typed in as "rm -rf /var / log/blah / ". Everyone knows it's awesome to insert white space to increase legibility. It was a production database server.

That’s an insane command to pass to an untrained person on a piece of paper to type into the terminal of a production server.

Agreed. It was "only" supposed to truncate the log folder. ;-)

Re: The day I locked everyone out of the company intranet

#125

Earlier quoted context omitted.

> can you rollback a drop table >_ The first thing I did after the recovery marathon was to alias rm so that it instead works by moving stuff to /tmp

inb4: /tmp partition gets full. Causing things to brake. :-)

No problem, just use rm ;)

Re: The day I locked everyone out of the company intranet

#126
post #17

My manager had got me to look at backups.. but for cheap. I decided on bacula - I had the clients installed on all the computers in the office, and it worked for some small tests. My manager decided we would try this with a USB drive attached to one of the servers (somehow this didn't seem like a bad idea). In the morning, very uncaffinated he sent me to the other site - an unmanned basement office with the servers.…

Yeah, for a surprisingly long time, linux had a big write cache problem. You were okay if you used all fast-writing devices. You were okay if you used all slow-writing devices. But if you mixed them, the slow writes could totally fill the write cache and starve everything else.

Not only an USB (1?) could cause it but also a cifs transfer over a 100 Mbps link.

Re: The day I locked everyone out of the company intranet

#127
post #12

I was working on an old old old "ERP" system written in D3 PICK. It's a database, programming language and OS all in one with roots in tracking military helicopter parts in the 1960's. I was working on it in the mid-2000s. It had SQL like syntax for manipulating data, but it was interactive. So you would SELECT the rows from the table that you wanted, then those rows would be part of your state. You would then do UPD…

I deal with D3 pick and the fear I have of doing select bp and catalog bp is insane. The entire system is a mess so wiping the md would be catastrophic. :)

Re: The day I locked everyone out of the company intranet

#128
post #45
post #23

Earlier quoted context omitted.

Once I wanted to do `rm -fr *~` to delete backup files, but the `~` key didn't register... Now I have learnt to instinctively stop before doing anything destructive and double-check and double-check again! This also applies to SQL `DELETE` and `UPDATE`! I know that `-r` was not neccessary but hey that was a biiiig mistake of mine!

For entirely critical systems, I by now rather generate a reviewable script and run that. Something along the lines of: find /backups/ -mtime '-30' -printf 'rm -f %p\n' > very_scary_deletes.sh This gives you a static script with a bunch of rm's. You can read that, check it, give it to people to validate and when you eventually run it, it deletes exactly those files.

That's clever, only do really dangerous things if you have a way to carefully review the steps.

Another way is sometimes: `echo *.txt~` and when you like the result, replace `echo` with `rm`.

Re: The day I locked everyone out of the company intranet

#129
post #45

Earlier quoted context omitted.

For entirely critical systems, I by now rather generate a reviewable script and run that. Something along the lines of: find /backups/ -mtime '-30' -printf 'rm -f %p\n' > very_scary_deletes.sh This gives you a static script with a bunch of rm's. You can read that, check it, give it to people to validate and when you eventually run it, it deletes exactly those files.

That's clever, only do really dangerous things if you have a way to carefully review the steps. Another way is sometimes: `echo *.txt~` and when you like the result, replace `echo` with `rm`.

I do this too. Although I usually do `echo rm .txt~` then just remove the `echo` once everything works. Also works well for things like `parallel` and `xargs` where you can do `parallel echo rm -- .txt` and it basically prints out a script. Then you can remove the `echo` to run it.

Re: The day I locked everyone out of the company intranet

#130
post #123
post #121

Earlier quoted context omitted.

I’m really curious: without cheating by using the GUI, what would be the proper way to delete such an obnoxiously-named directory? Would “$PWD/~” work?

A few ways. rm ./~ is likely the easiest. Another option, shell dependent, would be to turn off shell globbing. The `GNU` version of `find` has a `-maxdepth` option so find . -iname '~' -maxdepth 1 -exec rm {} \; would work, but I don't like relying on `GNU` extensions.

Or just: rm "~"
Post reply on HN