So today I rolled out an RPM to 2500 linux servers that had a post install script that tried to HUP my spam scanner. It had this section of code:
my $post = <<"EOT";
ps afxww |grep my_proc_name|grep -v grep|tail --lines=+2|awk '{print$1}'|xargs kill -HUP
EOT
You have to be pretty awake to spot the problem - the $1 in the awk script is interpolated in the string, so the awk script ends up being "awk '{print}'". This is very bad indeed. 2500 linux servers had to be rebooted. I owe a lot of beers.
Ouch... (Score:2)
Bummer... :-)
Random thoughts, which may or may not be helpful:
ps afxww |grep 'm[y]_proc_name'|tail --lines=+2|awk '{print$1}'|xargs kill -HUP
killall -HUP 'm[y]_proc_name'
--
DO NOT LEAVE IT IS NOT REAL.
And don't try this at home (Score:1)
Re:Ouch... (Score:1)
another perfectly good reason (Score:2)
Re:another perfectly good reason (Score:2)
The real issue is it not going through QA (and this happened because the code to build this RPM has been in the QA queue for 6 months and keeps getting overlooked in favour of more important projects).
It also shows that developers need sleep. I'm very tired right now and not sleeping well and am making stupid decisions because of this.
Re:another perfectly good reason (Score:1)
(1) killall is definitely better
(2) a good argument for using a pidfile and "kill existing daemon" code into the daemon
(3) or an rc script
(4) and definitely QA
Re:another perfectly good reason (Score:2)
Re:another perfectly good reason (Score:2)