Re:Man accidentally 'deletes his entire company' with one li...
by wahnfrieden on Thursday April 14, 2016 @12:23PM
(#11498016)
This is one of the reasons why we have infrastructure as code now, so system changes can be reviewed and tested just like application code, and more types of accidents can be reverted via source control :)
Re:Man accidentally 'deletes his entire company' with one li...
by djsumdog on Thursday April 14, 2016 @12:35PM
(#11498156)
In the article the guy is using ansible. He even had off-site backups, but they were mounted before his ansible playbooks ran, wiping them out as well.
Re:Man accidentally 'deletes his entire company' with one li...
by _kst_ on Thursday April 14, 2016 @03:55PM
(#11499845)
Another dangerous command is `crontab` with no arguments. It reads a new crontab from standard input. If you type Ctrl-C, it will abort and leave your existing crontab in place. If you type Ctrl-D, you've just created a new empty crontab and clobbered your old one.
My personal crontab is in a separate file in a source control system. I don't use `crontab -e`; I edit that file and feed it to the `crontab` command.
(It would be nice if HN handled backticks the way they're done in Markdown.)
Re:Man accidentally 'deletes his entire company' with one li...
by jo909 on Thursday April 14, 2016 @04:54PM
(#11500262)
A customer did this on his server once while I sat with him to add something. Since restoring the crontab from backups would have been a little inconvenient for such a small thing, I grepped the log files what commands were run by cron in what interval and had it rewritten in a few minutes.
Re:Man accidentally 'deletes his entire company' with one li...
by laumars on Thursday April 14, 2016 @12:39PM
(#11498186)
I've managed that one as well. One month into a new job and working on servers with complex applications installed that I wasn't yet familiar with. Thankfully I had `crontab -l` just beforehand, otherwise I'd have been screwed.
Re:Man accidentally 'deletes his entire company' with one li...
by hrktb on Thursday April 14, 2016 @12:59PM
(#11498400)
Most admins have a text file somewhere with the contents of the crontab. Specially because these things happen more often than it should.
Re:Man accidentally 'deletes his entire company' with one li...
by laumars on Thursday April 14, 2016 @03:00PM
(#11499452)
Indeed. I do generally keep backups of crontabs, not just in case of this kind of scenario but also in case the platform blows up in any unexpected ways. Sadly the company in question didn't. However I have since made it a personal policy to always -l before editing so I have a "backup" in my tmux scroll back (that time I mentioned before, it was pure chance that I had -l)
Re:Man accidentally 'deletes his entire company' with one li...
by neotrinity on Thursday April 14, 2016 @12:37PM
(#11498170)
did you mean crontab -r ?
I remember using crontab -r assuming that -r is to open it in read only mode. like vim -R
Bad assumption!
Re:Man accidentally 'deletes his entire company' with one li...
by laumars on Thursday April 14, 2016 @12:41PM
(#11498210)
> did you mean crontab -r ?
Some platforms it's -r, others it's -d. I suspect it's down to which cron daemon you run but never really cared enough to investigate. In any case, both are next to the 'e' key so either are just as dangerous in terms of typos.
Those two letters are eerily too close to eachother.