All pastes #878757 Raw Edit

Untitled

public text v1 · immutable
#878757 ·published 2008-01-29 14:59 UTC
rendered paste body
export PATH=$PATH:/usr/sbin:/usr/bin:/bin:/sbin

#Zet de hostname naar de asset tag
HOSTNAME=`ownership | awk '{print $1}'`
ASSETNAME=`dmidecode | grep -A12 "Chassis Information" | grep "Asset Tag" | awk '{print $3}'`
SERIALNAME=`dmidecode | grep -A12 "Chassis Information" | grep "Serial Number" | cut -d ":" -f 2 | sed -e s#\ ##`
echo ${HOSTNAME}
echo ${ASSETNAME}
echo ${SERIALNAME}
if ! [ "${HOSTNAME}" == "" ] ; then
        NAME="${HOSTNAME}"
elif ! [ "${ASSETNAME}" == "" ] && ! [ "${ASSETNAME}" == "Not" ]; then
        NAME="${ASSETNAME}"
elif ! [ "${SERIALNAME}" == "" ] ; then
        NAME="${SERIALNAME}"
fi

MAC=`/bin/ip addr | grep -B2 "scope global" | grep "link/ether" | cut -d " " -f 6`

echo -n '
exp_version -exit 5.0

set timeout 60

spawn telnet import.open.amsterdam.nl 7666
expect "OK:*" {
        send "NAME>' $NAME '\n"
        }

expect "OK:*" {
        send "MAC>' ${MAC} '\n"
        }

expect "OK:*" {
        send "BYE\n"
        }

expect "OK:*" {
        close
        }
' | expect