Fixed up crap
This commit is contained in:
parent
69f79d25d0
commit
bf3c8d0dfd
8 changed files with 107 additions and 537 deletions
|
@ -1,17 +1,24 @@
|
|||
#!/bin/sh
|
||||
if [ ! -f "$1" ] ; then
|
||||
echo "error: must specify active rooms file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NUM=0
|
||||
while read FOO; do
|
||||
if ! echo $FOO | grep -q ^#; then
|
||||
HOST="`echo $FOO | cut -d\| -f3`"
|
||||
MAC="`echo $FOO | cut -d\| -f1 | tr '[A-Z]' '[a-z]'`"
|
||||
IP="`echo $FOO | cut -d\| -f2`"
|
||||
if ! echo $HOST | egrep -q "(server|spare)"; then
|
||||
>&2 echo found host $HOST mac $MAC ip $IP num $NUM
|
||||
echo "$HOST|$MAC|$IP|$NUM"
|
||||
NUM=$((NUM+1))
|
||||
if ! echo $HOST | egrep -q "server"; then
|
||||
if grep -q "^$HOST\$" "$1" ; then
|
||||
>&2 echo found host $HOST mac $MAC ip $IP num $NUM
|
||||
echo "$HOST|$MAC|$IP|$NUM"
|
||||
NUM=$((NUM+1))
|
||||
fi
|
||||
elif echo $HOST | grep -q server; then
|
||||
>&2 echo found server at ip $IP
|
||||
echo $IP > SERVERIP
|
||||
fi
|
||||
fi
|
||||
done < $HOME/Dropbox/CAMS > HOSTS
|
||||
done < MASTER_LIST > HOSTS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue