[英]virsh destroy &> /dev/null still shows blank output
所以我有一個煩人的問題。 我有一個腳本可以更改給定文本文件的某些配置。 要更改該特定文件,我必須首先銷毀我的 KVM 上的虛擬機來賓。 問題是每次停止時,腳本的 output 中都會有一個空格,如您所見:
vfp-8vr Found!
Check if vfp-8vr has stopped ................................. [OK]
Check if vfp-8vr node has changed ............................ [OK]
Check if vfp-8vr has started ................................. [OK]
vfp-9vr Found!
Check if vfp-9vr has stopped ................................. [OK]
Check if vfp-9vr node has changed ............................ [OK]
Check if vfp-9vr has started ................................. [OK]
vfp-10vr Found!
Check if vfp-10vr has stopped ................................. [OK]
Check if vfp-10vr node has changed ............................ [OK]
Check if vfp-10vr has started ................................. [OK]
我已將 /dev/null 包含到我的腳本中,因為它隱藏了 output,理論上它可以工作,但無論如何都會出現銀行空間......
for i in "${arr[@]}"
do
if [[ -n "$i" ]]
then
echo "$i Found!"
virsh destroy $i &> /dev/null
echo -e "Check if \e[32m$i\e[0m has stopped ................................. [OK]"
virsh numatune $i $opt_node0
echo -e "Check if \e[32m$i\e[0m node has changed ............................ [OK]"
virsh start $i &> /dev/null
echo -e "Check if \e[32m$i\e[0m has started ................................. [OK]"
fi
done
有誰知道如何在后台運行virsh destroy
而不在 output 中顯示煩人的空間?
免責聲明:我已經使用了[Command] > /dev/null 2>&1 &
,同樣的事情:/
傻我,我忘了添加 /dev/null 到 virsh numatune 命令:
Check if vfp-8vr has stopped ................................. [OK]
Check if vfp-8vr node has changed ............................ [OK]
Check if vfp-8vr has started ................................. [OK]
vfp-9vr Found!
Check if vfp-9vr has stopped ................................. [OK]
Check if vfp-9vr node has changed ............................ [OK]
Check if vfp-9vr has started ................................. [OK]
vfp-10vr Found!
Check if vfp-10vr has stopped ................................. [OK]
Check if vfp-10vr node has changed ............................ [OK]
Check if vfp-10vr has started ................................. [OK]
感謝社區!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.