Article 4JNXF Representative Line: Classic WTF: The Backup Snippet

Representative Line: Classic WTF: The Backup Snippet

by
Alex Papadimoulis
from The Daily WTF on (#4JNXF)
It's "Independence Day" here in the US, which is the day in which developers celebrate their independence from DBAs and switch everything over to NoSQL, no matter what the cost. Or something like that, the history is a little fuzzy. But it's a holiday here, so in honor of that, here's a related story. Original --Remy

Generally speaking, Andrew tries his best to avoid the DBA team. It's not just because database administrators tend to be a unique breed (his colleagues were certainly no exception), but because of the "things" that he'd heard about the team. The sort of "things" that keep developers up at night and make them regret not becoming an accountant.

One day, while debugging an issue with their monitoring scripts, Andrew had no choice but to check with Thom, a member of Team DBA. It turned out that one of DBA's had recently updated their database backup script, but Thom wasn't really sure who did it, why it was done, or what it looked like before. So, he just sent Andrew the entire backup script.

Following is a single line of code, line-wrapped by yours truly, that should give a fair idea of what the script was like.

file=$WORKSPACE/ewprd1_$DATECODE.dmp,$WORKSPACE/ewprd2_$DATECODE.dmp,$WORKSPACE/ewprd3_$DATECODE.dmp,$WORKSPACE/ewprd4_$DATECODE.dmp,$WORKSPACE/ewprd5_$DATECODE.dmp,$WORKSPACE/ewprd6_$DATECODE.dmp,$WORKSPACE/ewprd7_$DATECODE.dmp,$WORKSPACE/ewprd8_$DATECODE.dmp,$WORKSPACE/ewprd9_$DATECODE.dmp,$WORKSPACE/ewprd10_$DATECODE.dmp,$WORKSPACE/ewprd11_$DATECODE.dmp,$WORKSPACE/ewprd12_$DATECODE.dmp,$WORKSPACE/ewprd13_$DATECODE.dmp,$WORKSPACE/ewprd14_$DATECODE.dmp,$WORKSPACE/ewprd15_$DATECODE.dmp,$WORKSPACE/ewprd16_$DATECODE.dmp,$WORKSPACE/ewprd17_$DATECODE.dmp,$WORKSPACE/ewprd18_$DATECODE.dmp,$WORKSPACE/ewprd19_$DATECODE.dmp,$WORKSPACE/ewprd20_$DATECODE.dmp,$WORKSPACE/ewprd21_$DATECODE.dmp,$WORKSPACE/ewprd22_$DATECODE.dmp,$WORKSPACE/ewprd23_$DATECODE.dmp,$WORKSPACE/ewprd24_$DATECODE.dmp,$WORKSPACE/ewprd25_$DATECODE.dmp,$WORKSPACE/ewprd26_$DATECODE.dmp,$WORKSPACE/ewprd27_$DATECODE.dmp,$WORKSPACE/ewprd28_$DATECODE.dmp,$WORKSPACE/ewprd29_$DATECODE.dmp,$WORKSPACE/ewprd30_$DATECODE.dmp,$WORKSPACE/ewprd31_$DATECODE.dmp,$WORKSPACE/ewprd32_$DATECODE.dmp,$WORKSPACE/ewprd33_$DATECODE.dmp,$WORKSPACE/ewprd34_$DATECODE.dmp,$WORKSPACE/ewprd35_$DATECODE.dmp,$WORKSPACE/ewprd36_$DATECODE.dmp,$WORKSPACE/ewprd37_$DATECODE.dmp,$WORKSPACE/ewprd38_$DATECODE.dmp,$WORKSPACE/ewprd39_$DATECODE.dmp,$WORKSPACE/ewprd40_$DATECODE.dmp,$WORKSPACE/ewprd41_$DATECODE.dmp,$WORKSPACE/ewprd42_$DATECODE.dmp,$WORKSPACE/ewprd43_$DATECODE.dmp,$WORKSPACE/ewprd44_$DATECODE.dmp,$WORKSPACE/ewprd45_$DATECODE.dmp,$WORKSPACE/ewprd46_$DATECODE.dmp,$WORKSPACE/ewprd47_$DATECODE.dmp,$WORKSPACE/ewprd48_$DATECODE.dmp,$WORKSPACE/ewprd49_$DATECODE.dmp,$WORKSPACE/ewprd50_$DATECODE.dmp,$WORKSPACE/ewprd51_$DATECODE.dmp,$WORKSPACE/ewprd52_$DATECODE.dmp,$WORKSPACE/ewprd53_$DATECODE.dmp,$WORKSPACE/ewprd54_$DATECODE.dmp,$WORKSPACE/ewprd55_$DATECODE.dmp,$WORKSPACE/ewprd56_$DATECODE.dmp,$WORKSPACE/ewprd57_$DATECODE.dmp,$WORKSPACE/ewprd58_$DATECODE.dmp,$WORKSPACE/ewprd59_$DATECODE.dmp,$WORKSPACE/ewprd60_$DATECODE.dmp,$WORKSPACE/ewprd61_$DATECODE.dmp,$WORKSPACE/ewprd62_$DATECODE.dmp,$WORKSPACE/ewprd63_$DATECODE.dmp,$WORKSPACE/ewprd64_$DATECODE.dmp,$WORKSPACE/ewprd65_$DATECODE.dmp,$WORKSPACE/ewprd66_$DATECODE.dmp,$WORKSPACE/ewprd67_$DATECODE.dmp,$WORKSPACE/ewprd68_$DATECODE.dmp,$WORKSPACE/ewprd69_$DATECODE.dmp,$WORKSPACE/ewprd70_$DATECODE.dmp,$WORKSPACE/ewprd71_$DATECODE.dmp,$WORKSPACE/ewprd72_$DATECODE.dmp,$WORKSPACE/ewprd73_$DATECODE.dmp,$WORKSPACE/ewprd74_$DATECODE.dmp,$WORKSPACE/ewprd75_$DATECODE.dmp,$WORKSPACE/ewprd76_$DATECODE.dmp,$WORKSPACE/ewprd77_$DATECODE.dmp,$WORKSPACE/ewprd78_$DATECODE.dmp,$WORKSPACE/ewprd79_$DATECODE.dmp,$WORKSPACE/ewprd80_$DATECODE.dmp,$WORKSPACE/ewprd81_$DATECODE.dmp,$WORKSPACE/ewprd82_$DATECODE.dmp,$WORKSPACE/ewprd83_$DATECODE.dmp,$WORKSPACE/ewprd84_$DATECODE.dmp,$WORKSPACE/ewprd85_$DATECODE.dmp,$WORKSPACE/ewprd86_$DATECODE.dmp,$WORKSPACE/ewprd87_$DATECODE.dmp,$WORKSPACE/ewprd88_$DATECODE.dmp,$WORKSPACE/ewprd89_$DATECODE.dmp,$WORKSPACE/ewprd90_$DATECODE.dmp,$WORKSPACE/ewprd91_$DATECODE.dmp,$WORKSPACE/ewprd92_$DATECODE.dmp,$WORKSPACE/ewprd93_$DATECODE.dmp,$WORKSPACE/ewprd94_$DATECODE.dmp,$WORKSPACE/ewprd95_$DATECODE.dmp,$WORKSPACE/ewprd96_$DATECODE.dmp,$WORKSPACE/ewprd97_$DATECODE.dmp,$WORKSPACE/ewprd98_$DATECODE.dmp,$WORKSPACE/ewprd99_$DATECODE.dmp,$WORKSPACE/ewprd100_$DATECODE.dmp,$WORKSPACE/ewprd101_$DATECODE.dmp,$WORKSPACE/ewprd102_$DATECODE.dmp,$WORKSPACE/ewprd103_$DATECODE.dmp,$WORKSPACE/ewprd104_$DATECODE.dmp,$WORKSPACE/ewprd105_$DATECODE.dmp,$WORKSPACE/ewprd106_$DATECODE.dmp,$WORKSPACE/ewprd107_$DATECODE.dmp,$WORKSPACE/ewprd108_$DATECODE.dmp,$WORKSPACE/ewprd109_$DATECODE.dmp,$WORKSPACE/ewprd110_$DATECODE.dmp,$WORKSPACE/ewprd111_$DATECODE.dmp,$WORKSPACE/ewprd112_$DATECODE.dmp,$WORKSPACE/ewprd113_$DATECODE.dmp,$WORKSPACE/ewprd114_$DATECODE.dmp,$WORKSPACE/ewprd115_$DATECODE.dmp,$WORKSPACE/ewprd116_$DATECODE.dmp,$WORKSAPCE/ewprd117_$DATECODE.dmp,$WORKSPACE/ewprd118_$DATECODE.dmp

Andrew eventually found the problem, and offered a helpful tip to Thom for shortening up their script:

file="$WORKSPACE/ewprd1_$DATECODE.dmp";for ((i=2;$i<119;i++)); do { FILE="$FILE,$WORKSPACE/ewprd$i_$DATECODE.dmp";}; done

It accomplished the exact same thing in four little lines. Thom passed on the suggestion, however, perhaps because it would have increased the line count... or, most likely, to keep the developers out.

raygun50.png [Advertisement] Forget logs. Next time you're struggling to replicate error, crash and performance issues in your apps - Think Raygun! Installs in minutes. Learn more. TheDailyWtf?d=yIl2AUoC8zASyWeRgolcRs
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments