SOLVED Delete multiple "Periodic Snapshot Tasks" at once

T-One

Cadet
Joined
Oct 24, 2020
Messages
8
Hello,

i created a "Periodic Snapshot Task" and clicked "Recursive", now i have a couple hundred Snapshot Tasks and want to start over with a more selective setup.
Is there a way to delete multiple or all of this tasks at once via CLI? I couldn't find anything in the GUI (just a "Select All").

Thanks in advance.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
you can get a list of all the IDs with midclt call pool.snapshottask.query and then call midclt call pool.snapshottask.delete X (where X is the ID of the task you want deleted) You could script it to do a range of IDs.
 

T-One

Cadet
Joined
Oct 24, 2020
Messages
8
Thank you, i did not know of the midclt command.

Super ugly but it works:

Code:
midclt call pool.snapshottask.query | python -m json.tool | awk -v n=1 '/SSD\// && NR>n {print window[(NR-n)%n]}{window[NR%n]=substr($2, 1, length($2)-1)}' | while read line; do midclt call pool.snapshottask.delete $line; done


SSD is the Dataset i filter (with \/ for trailing slash), substr.... in the awk deletes the trailing "," of the "ID:".
 
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Top