Skip to content

Instantly share code, notes, and snippets.

@metalrufflez
metalrufflez / migratevm.sh
Created November 21, 2011 14:05
Migrate Xen 5.* VMs using an external disk on the newhost
#!/bin/bash
# Uncomment the lines below to print the commands instead of executing them
# DEBUG refers to exporting from external dom0
# DEBUG2 refers to importing the vm to local dom0
#DEBUG="echo"
#DEBUG2="echo"
# You HAVE to inform at lease vm and host or else, usage in your face
if [ "$#" -lt 2 ]; then
@metalrufflez
metalrufflez / monitordhl.sh
Created November 21, 2011 13:54
Script to parse and mail DHL tracking updates
#!/bin/bash
URL='http://www.dhl.com/content/g0/en/express/tracking.shtml?brand=DHL&AWB=<INSERT_TRACKING_CODE_HERE>%0D%0A'
BULK="$(curl -s "$URL" | egrep -A1 -m1 '<td class=".*" style="width: 5% ;text-align:left">.+</td>' | egrep -o '>.+<' | sed 's/[><]//g')"
CODE="$(echo $BULK | cut -d " " -f1)"
CTLFILE=/root/ctlfile
if [ "$CODE" -ne "$(cat $CTLFILE)" ]; then
echo $CODE > $CTLFILE
mail -s "DHL Update" <INSERT_YOUR_EMAIL_HERE> < <(echo $BULK)