Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # find and delete running instances with display name like test
- for i in $(oci search resource structured-search --query-text "QUERY instance resources where lifeCycleState = 'RUNNING' && displayName =~ 'test' && compartmentId = 'ocid1.compartment.oc1..<compartment-id>' " --query 'data.items[*].identifier' --raw-output|sed 's/\"//g;s/,//g'|egrep -v -e "\[" -e "\]")
- do
- time oci compute instance terminate --instance-id "$i" --force
- done
- real 0m1.218s
- user 0m0.664s
- sys 0m0.060s
- real 0m1.142s
- user 0m0.643s
- sys 0m0.050s
- real 0m1.189s
- user 0m0.648s
- sys 0m0.050s
- real 0m1.141s
- user 0m0.622s
- sys 0m0.050s
- real 0m1.066s
- user 0m0.607s
- sys 0m0.062s
- real 0m1.046s
- user 0m0.605s
- sys 0m0.072s
- real 0m0.912s
- user 0m0.604s
- sys 0m0.059s
- real 0m1.068s
- user 0m0.655s
- sys 0m0.069s
- real 0m1.058s
- user 0m0.633s
- sys 0m0.060s
- real 0m0.995s
- user 0m0.651s
- sys 0m0.050s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement