I have a loop which is giving me the output as below:
Name: "abc".
Backup Locked: true.
Name: "def".
Backup Locked: false.
I would like to execute some command for those clients whose value for backup Locked come as true. Here is my code below
#!/bin/sh
cd /opt/emc/vproxy/bin/
source ../unit/vproxy.env
while IFS= read -r line ; do ./vmconfig -c info -k "$line" -l moref moref -p '*******' -u "username" -v "vcenter" | egrep -i 'Name|Backup Locked'
Lock=("Backup Locked:")
Value=("true.")
if [[ "$Lock" == "$Value" ]] ; then
source ../unit/vproxy.env
./vmconfig -c info -k "$line" -l moref -p '*******' -u "username" -v "vcenter" -c "reset-backup"
fi
done < "/home/Backup-Scripts/VM-ID-List.txt"
Code is not working.
Aucun commentaire:
Enregistrer un commentaire