Advertisement
that0n3guy

xcp-vapp-autostart

Aug 11th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. # AutoStart Vapp's that have autostart in description
  2. # Script created by Raido Consultants - http://www.raido.be
  3. TAG="autostart"
  4. # helper function
  5. function xe_param()
  6. {
  7. PARAM=$1
  8. while read DATA; do
  9. LINE=$(echo $DATA | egrep "$PARAM")
  10. if [ $? -eq 0 ]; then
  11. echo "$LINE" | awk 'BEGIN{FS=": "}{print $2}'
  12. fi
  13. done
  14. } # Get all Applicances
  15. sleep 20
  16. VAPPS=$(xe appliance-list | xe_param uuid) for VAPP in $VAPPS; do
  17. echo "Raido AutoStart : Checking vApp $VAPP"
  18. VAPP_TAGS="$(xe appliance-param-get uuid=$VAPP param-name=name-description)" if [[ $VAPP_TAGS == *$TAG* ]]
  19. then
  20. echo "starting vApp $VAPP"
  21. xe appliance-start uuid=$VAPP
  22. sleep 20
  23. fi
  24. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement