Code Monkey home page Code Monkey logo

Comments (2)

fdleersn avatar fdleersn commented on July 28, 2024

Hi Rob,

I believe this would break the check for the other versions.
Perhaps using sed or grep to match the version is more suitable.

something like the following sed does the trick

ESX_VERSION=$(vmware -v | sed -e 's#.([3-9].[0-9].[0-9]).#\1#')

but that wouldn't catch 3i. Although it does match any version formatted x.x.x. So that might be good enough as 3.5.0 is also in the line.

using grep on the other hand might be more flexible/readable if syntax is changed in future versions

ESX_VERSION=$(vmware -v)

if echo "${ESX_VERSION}" | grep -E '5.0.0|5.1.0' >/dev/null 2>&1; then
VER=5
elif echo "${ESX_VERSION}" | grep -E '4.0.0|4.1.0' >/dev/null 2>&1; then
VER=4
elif echo "${ESX_VERSION}" | grep -E '3.5.0' >/dev/null 2>&1; then
VER=3
else
echo "You're not running ESX(i) 3.5, 4.x, 5.x!"; exit 1;
fi

Best regards,
Fréderic

On 1-feb.-2013, at 01:05, RobMarshall109 [email protected] wrote:

I've been running ghettoVCB for a while now and it has been working great. I just updated to the latest version and found that on my 1 ESXi 3.5 host the script would fail with the error - "You're not running ESX(i) 3.5, 4.x, 5.x!".

I found by changing following line, the issue was resolved

ESX_VERSION=$(vmware -v | awk '{print $3}')

to

ESX_VERSION=$(vmware -v | awk '{print $4}')

The vmware version info comes back as the following on my host:

~ # vmware -v
VMware ESX Server 3i 3.5.0 build-207095
~ # vmware -v | awk '{print $3}'
Server
~ # vmware -v | awk '{print $4}'
3i


Reply to this email directly or view it on GitHub.

from ghettovcb.

lamw avatar lamw commented on July 28, 2024

@fdleersn Thanks for helping out, it looks like the change in the case statement did in fact break ESXi 3.5 version checking. I've gone ahead and implemented your solution and will be pushing it up to the development branch. Thanks

from ghettovcb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.