Administrator's Guide

selective_restore=0
# Check for unzip package.
command -v unzip &> /dev/null
if [ $? -ne 0 ]; then
echo "The unzip package must be installed to use this script."
exit 1
fi
# Check the user specified script parameters.
if [ $# -lt 3 ]; then
echo "Usage : restoreTeam <user> <domain> [<ip1> <ip2> ...] <user@IP:path>"
echo " <user> - user name to access the controller"
echo " <domain> - domain of the controller"
echo " [<ip1> <ip2> ...] - ip(s) of node(s) to be restored; if none are specified all nodes are restored"
echo " <user@IP:path> - remote location to retrieve backup file"
echo " user - the login name for the system"
echo " ip - the ip address of the system"
echo " path - where to copy the file from on the remote system"
exit 1
fi
create_restoreDir
user="$1"
echo -n "Enter Controller Password: "
read -s pass
echo
domain="$2"
file=""
if [ $# -eq 3 ]; then
teamBackup_log "Starting the team restore. This will restore all the nodes in a team."
file=$3
else
teamBackup_log "Starting selective restore on specified IPs. This restore will happen only on the specified
nodes."
count=0
selective_restore=1
for ip in "$@"; do
restoreIp[$count]=$ip
let "count = $count + 1"
done
fileIndex=$(($# - 1))
file=${restoreIp[$fileIndex]} && unset restoreIp[$fileIndex]
fi
# Upload the team backup file from the user specified location.
scp $file $RESTORE_TEAM_DIR
if [ $? -ne 0 ]; then
teamBackup_log "Failed to upload team backup file to the node."
exitBackup 1
fi
# Unzip the team backup file.
extract_zip_and_ip
# Validate the IP address of the node.
validate_my_Ip
# Restore the node(s).
if [ $selective_restore -eq 1 ]; then
restore_nodes ${restoreIp[@]}
else
restore_nodes ${backupIp[@]}
fi
echo
teamBackup_log "The team was restored successfully."
exitBackup 0
130 Scripts