I needed to distribute, backup and install some files to a large number of servers today. I had wrote most of a small script when I was reminded of a maxim that I often forget: Make use of package managers.
Everything my script did a package manager would do much better. The quickest way to create a simple package (an rpm in my case) is to simply tar up the files that need distributed (with all ownership and permissions set) then use a tool like tar2rpm.sh to create an rpm. You can use similar tools for the package manager of your choice.
Before I was reminded to use a package manager I was quite content writing my little script, refining it and admiring my handiwork. I reflected some on the writing of scripts – my thoughts :
Writing scripts – ideally elegant ones – is a good bit of art and creativity to inject into the technical world of system administration and development. It is nearly alway worth the time.
I was also reminded to stop judging other people’s scripts – I don’t really judge per se, but I do tend at times to slightly frown upon someone else’s method of writing something. The cause of course is the very thing that can make a script elegant – readability versus cleverness. Too much cleverness can be annoying. No cleverness – the same. I need to give other people’s cleverness a bit more time before marking it as unnecessarily obtuse. The same goes for scripts that are a bit too verbose (a more rare issue).