Hi all,
                I sometimes want to verify what TFTP is sending, but with 
tftp.py now being dynamic, I can't just cat the 
/tftpboot/pxelinux.cfg/01-xx-xx-xx-xx-xx-xx file. So I whipped up a quick BASH 
script to do this, and thought I'd share. Hope someone finds it handy.

--8<-----------------------------------------------------
#!/bin/bash

trap 'echo;exit' SIGINT

function usage () {
echo "Usage: $0 [-d] hostname"
echo "       -d enables debug output"
exit
}

while getopts d opt; do
    case $opt in
        d) DEBUG=1 ;;
        ?) usage ;;
    esac
done

shift $(($OPTIND - 1))
if [[ $# -ne 1 ]]; then usage; fi

(($DEBUG)) && set -x

tftp ${DEBUG:+-v} 0 -c get /pxelinux.cfg/01-`cobbler system report --name $1 
2>/dev/null |awk '/^MAC/ && NF==4 {gsub(/:/, "-", $NF); print $NF; exit}'` 
/dev/stdout
--8<-----------------------------------------------------



*******************************************************
This message (including any files transmitted with it) may contain confidential 
and/or proprietary information, is the property of Interactive Data Corporation 
and/or its subsidiaries, and is directed only to the addressee(s). If you are 
not the designated recipient or have reason to believe you received this 
message in error, please delete this message from your system and notify the 
sender immediately. An unintended recipient's disclosure, copying, 
distribution, or use of this message or any attachments is prohibited and may 
be unlawful. 
*******************************************************
_______________________________________________
cobbler mailing list
cobbler@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to