Created
March 18, 2015 13:36
-
-
Save cpswan/e1fbc6dcb381e40eede2 to your computer and use it in GitHub Desktop.
Create and retrieve a snapshot from a VNS3 manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
command -v curl >/dev/null 2>&1 || { echo "This script requires curl, but it's not installed. Aborting." >&2; exit 1; } | |
MGRIP=10.0.0.10 | |
APIPW=pa55Word | |
SNAPSHOTJSON=`curl -k -X POST -u api:$APIPW https://$MGRIP:8000/api/snapshots` | |
SNAPSHOTNAME=$(echo $SNAPSHOTJSON | grep -Po '"response":{.*?[^\\]"' | awk '{split($0,a,"{"); print a[2]}' ) | |
curl -k -X GET -H 'Content-Type: application/json' https://api:$APIPW@$MGRIP:8000/api/snapshots/${SNAPSHOTNAME//\"} -o ${SNAPSHOTNAME//\"} | |
echo "Created and retrieved $SNAPSHOTNAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment