#!/bin/bash
#
# (c) Angelo Conforti, 2007
# reports the status of a VM
#

VM=$1

if [ "$VM" == "" ] ; then
        echo $0 cfg_file
        exit 3
fi

STATUS=`vmware-cmd -q "$VM" getstate`


if [ $STATUS == 'on' ] ; then
        echo "VM $VM is OK"
        OUT_CODE=0;
else
        echo "VM $VM is not running"
        OUT_CODE=1;
fi

exit $OUT_CODE;
