ONTAP Discussions

Delete snapshots via bash and ssh

BobMoore
328 Views

I am trying to delete close to a hundred snapshots left over from a migration using SVM-DR.

 

I have built a file called snaplist that contains:
vserver volume snapshot

 

Then i run a while loop to go through the file:

while read vserv vol snap

do
ssh -n admin@cluster "set adv -c off ; volume snapshot delete -vserver $vserv -volume $vol -snapshot $snap -force true"; sleep 3; done < snaplist

 

I get this error when io try to run it:

 

" is an invalid value for field "-foreground <true|false>"
Valid choices in this command's context: true, false
" for parameter "-foreground". A future release may
require "-foreground" to be specified before the value.

 

I can't seem to figure where that's coming from! I'm sure it's something stupid I'm missing!

Any help would be appreciated!

2 REPLIES 2

Sanaman
282 Views

I think your bash is not interpreting the variables correctly. I would use awk like this;

Sanaman_0-1728533468651.png

 

liu
262 Views

Hello. This is what I do regarding the virtual environment. How much can I execute this command in your version?

liu_0-1728547402344.png

liu_1-1728547418609.pngliu_2-1728547428121.png

look this  volume snapshot delete (netapp.com)

 

Public