updateip.sh
· 766 B · Bash
Sin formato
#!/bin/bash
DOMAIN=$1
OLDIP=$2
NEWIP=$3
SERVERNAME=$4
echo "Adding new IP to domain"
samba-tool dns add localhost $DOMAIN $SERVERNAME.$DOMAIN A $NEWIP
samba-tool dns add localhost $DOMAIN $DOMAIN A $NEWIP
samba-tool dns add localhost _msdcs.$DOMAIN gc A $NEWIP
samba-tool dns add localhost $DOMAIN DomainDnsZones.$DOMAIN A $NEWIP
samba-tool dns add localhost $DOMAIN ForestDnsZones.$DOMAIN A $NEWIP
echo "Removing old IP from domain"
samba-tool dns delete localhost _msdcs.$DOMAIN gc A $OLDIP
samba-tool dns delete localhost $DOMAIN $SERVERNAME.$DOMAIN A $OLDIP
samba-tool dns delete localhost $DOMAIN $DOMAIN A $OLDIP
samba-tool dns delete localhost $DOMAIN DomainDnsZones.$DOMAIN A $OLDIP
samba-tool dns delete localhost $DOMAIN ForestDnsZones.$DOMAIN A $OLDIP
| 1 | #!/bin/bash |
| 2 | |
| 3 | DOMAIN=$1 |
| 4 | OLDIP=$2 |
| 5 | NEWIP=$3 |
| 6 | SERVERNAME=$4 |
| 7 | |
| 8 | echo "Adding new IP to domain" |
| 9 | samba-tool dns add localhost $DOMAIN $SERVERNAME.$DOMAIN A $NEWIP |
| 10 | samba-tool dns add localhost $DOMAIN $DOMAIN A $NEWIP |
| 11 | samba-tool dns add localhost _msdcs.$DOMAIN gc A $NEWIP |
| 12 | samba-tool dns add localhost $DOMAIN DomainDnsZones.$DOMAIN A $NEWIP |
| 13 | samba-tool dns add localhost $DOMAIN ForestDnsZones.$DOMAIN A $NEWIP |
| 14 | |
| 15 | echo "Removing old IP from domain" |
| 16 | samba-tool dns delete localhost _msdcs.$DOMAIN gc A $OLDIP |
| 17 | samba-tool dns delete localhost $DOMAIN $SERVERNAME.$DOMAIN A $OLDIP |
| 18 | samba-tool dns delete localhost $DOMAIN $DOMAIN A $OLDIP |
| 19 | samba-tool dns delete localhost $DOMAIN DomainDnsZones.$DOMAIN A $OLDIP |
| 20 | samba-tool dns delete localhost $DOMAIN ForestDnsZones.$DOMAIN A $OLDIP |
| 21 |