1 |
douglas |
856 |
#!/usr/local/bin/bash |
2 |
|
|
# MPD Interface Down |
3 |
|
|
# |
4 |
|
|
# Douglas Thrift |
5 |
|
|
# |
6 |
|
|
# $Id$ |
7 |
|
|
|
8 |
douglas |
1005 |
function usage() |
9 |
|
|
{ |
10 |
|
|
echo -e "Usage: `basename $0` \e[1minterface\e[0m inet \e[1mlocal-ip remote-ip authname\e[0m" |
11 |
|
|
exit 1 |
12 |
|
|
} |
13 |
|
|
|
14 |
|
|
[[ $# -ne 5 ]] && usage |
15 |
|
|
|
16 |
douglas |
856 |
root=`dirname $0` |
17 |
|
|
|
18 |
douglas |
1005 |
source $root/mpd-common.sh |
19 |
douglas |
856 |
|
20 |
|
|
read -r hostname reverse < ~/.mpd-nsupdate.$interface || exit $? |
21 |
|
|
|
22 |
douglas |
1005 |
key |
23 |
douglas |
856 |
|
24 |
|
|
nsupdate <<EOF |
25 |
|
|
key $name $secret |
26 |
|
|
update delete $hostname IN A |
27 |
douglas |
859 |
send`if [[ -n $reverse ]]; then echo " |
28 |
douglas |
856 |
update delete $reverse IN PTR |
29 |
douglas |
859 |
send"; fi` |
30 |
douglas |
856 |
EOF |
31 |
|
|
|
32 |
|
|
rm ~/.mpd-nsupdate.$interface |