NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

ONTAP Discussions

Delete snapshots via bash and ssh

BobMoore
1,813 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
1,767 Views

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

Sanaman_0-1728533468651.png

 

liu
1,747 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