Quantcast
Channel: virtuallyPeculiar
Viewing all articles
Browse latest Browse all 167

Automating Backup Cancellation From Command Line

$
0
0
This script allows you to mass cancel active backup jobs from command line of vSphere Data Protection Appliance.
#!/bin/bash
# This script cancels all active backup jobs from the command line
value=$(mccli activity show --active | cut -c1-16 | sed -e '1,3d')
if [ -z "$value" ]
then
echo "No active job to cancel"
else
for p in $value
do
mccli activity cancel --id=$p
done
fi


If you would like to cancel a set of backup jobs, like 13 jobs out of 20 running jobs, then you need to add those Job ID's to a file and then run the script to pull inputs from that file
#!/bin/bash
# This script cancels jobs from IDs provided in the id.txt file
while read p; do
mccli activity cancel --i
d=$p
done <id.txt

This script can be modified for other backup states like waiting-client. Just Grep, and cut, and remove the first three rows and feed the job ID's to a loop.

Chmod a+x to the file for execute. Hope this helps!


Viewing all articles
Browse latest Browse all 167

Trending Articles