Skip to content
Snippets Groups Projects
Commit 4ca2c562 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

onevm: fix output if no vm is running

parent 0779f05a
No related branches found
No related tags found
1 merge request!114onevm: fix output if no vm is running
......@@ -33,13 +33,14 @@
# STAT:done:Done:The VM is done. VMs in this state won’t be shown with onevm list but are kept in the database for accounting purposes. You can still get their information with the onevm show command.
# ----------------------------------------------------------------------
# 2023-06-12 v1.0 <axel.hahn@unibe.ch> initial version
# 2023-06-15 v1.0 <axel.hahn@unibe.ch> fix output if no vm is running
# ======================================================================
. $(dirname $0)/inc_pluginfunctions
self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] )
self_APPVERSION=1.0
self_APPVERSION=1.1
# new line
NL="
......@@ -115,10 +116,10 @@ csvdata=$( echo "$cmdout" | sed -n '2,$p' )
# --- get result
out=""
typeset -i iTotal; iTotal=$( echo "$csvdata" | wc -l )
typeset -i iRunning; iRunning=$( echo "$csvdata" | grep -c ",runn," )
typeset -i iFail; iFail=$( echo "$csvdata" | grep -c ",fail," )
typeset -i iUnknown; iUnknown=$( echo "$csvdata" | grep -c ",unkn," )
typeset -i iTotal; iTotal=$( grep -c . <<< "$csvdata" )
typeset -i iRunning; iRunning=$( grep -c ",runn," <<< "$csvdata" )
typeset -i iFail; iFail=$( grep -c ",fail," <<< "$csvdata" )
typeset -i iUnknown; iUnknown=$( grep -c ",unkn," <<< "$csvdata" )
typeset -i iOther; iOther=$iTotal-$iRunning-$iFail-$iUnknown
ph.perfadd "total" "${iTotal}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment