Skip to main content

I am trying to identify the Apache2 version to scope systems that need an update, but I am experiencing some unexpected results. My EA script:



#!/bin/sh

result=`httpd -v | grep "Unix" | awk '{print $3}' | cut -f2 -d"/"`
echo "<result>$result</result>"


When I run as root on my test system, the result is what I expect to see:
<result>2.4.46</result>
But the EA result in JAMF pro is 2.4.41.



A few details that may help: 2.4.41 is the version that ships with 10.15. I am leveraging MacPorts for the Apache2 update to 2.4.46.



Any ideas are appreciated :)

1st of all:



result="$(httpd -v | awk '/Server version/{print substr($3,8)}')"


2nd: I believe it is highly likely you have 2 versions installed. Can you give anymore detail on the install? Thanks.


Thank you for the reply, and the more concise notation.



Yes, it looks like there are multiple versions installed. Running a quick



sudo find / -name "httpd" -exec sudo {} -v ; | awk '/Server version/{print substr($3,8)}'


showed me JAMF is running httpd located in /usr/sbin. Modified my script explicitly use /usr/local/bin/httpd, and its picking up 2.4.46 on my test machine.



Appreciate your input on this.



Working EA script:



#!/bin/sh


result="$(/usr/local/bin/httpd -v | awk '/Server version/{print substr($3,8)}')"
echo "<result>$result</result>"