It’s the details, silly Perl error

Just today I was troubleshooting what seemed to be a spurious error in the logs of a script I wrote. The script itself isn’t all that important to this discussion but what I found in troubleshooting irked me to no end and I felt like I had to write about it.

In my script I have two places where I run a “find” command via the system() call to do very specific work. In this case doing recursive permissions and file mode changes on a directory.

Take a look at the offending line?

Looks innocent doesn’t it?   What you have there is an interpolation bomb for a lack of better term for it.  The error I was seeing was “find: missing argument to `-exec'” which after a bit of thought I realized the command the shell was actually seeing was “ find mydir -type f -exec chmod 0644 {} ; ” which would be missing the backslash as find would expect to be there. Whoops.

The reason for this would be everything inside the double quotes gets interpolated and the interpolation in play here was an unnecessary escape of the semicolon.  Modifying my code with a single quote thusly:


You know… really I should be using File::Find instead… but sometimes laziness gets the better of me…


DevOps — from a practitioner’s viewpoint

So what is DevOps all about anyways?

If you ask ten people what DevOps is you will get at least ten different answers and I find that the difference in definitions has a lot to do with the person being asked perspective.  Managers see one thing, developers another and the operations team something complete different.

My both being developer and a long term Unix/Linux professional including in the realms of system administration and operations I have yet another viewpoint on this.

Citing WikiPedia DevOps combines software development (Dev) with information technology operations (Ops) with the goal in mind of shortening the systems development life cycle all at the same time delivering features, fixes and updates while staying aligned with business goals and philosophy.

To this end a lot of great toolsets are employed to make all this happen.

So what am I going to talk about in this blog?  I currently work as a consultant designing and maintaining a Puppet infrastructure for a software development team.  Along with Puppet tools I use include Jenkins, Git, Docker, Perl and others. So going just a little past the limits of DevOps I’m going to talk about my favorite scripting language Perl.

I’ll also talk about Nagios which is my tool of choice for system and network monitoring.


Copyright DevOps — In the Trenches 2019
Tech Nerd theme designed by Siteturner