It looks like you're new here. If you want to get involved, click one of these buttons!
svcadm restart /network/dns/server:default svcs -xv /network/dns/server:default to systemctl restart bind systemctl status bind
# Bind Updater for Solaris, Linux, and any thing that is bash! # Updates your Dynamic IP address in your A record! #Change directory for log destination log=bind_update.log #Get used ip address useip=`cat useip` #Get current Public IP ip_address=`wget http://ipecho.net/plain -O - -q ; echo` #Get the ip address to replace and save in varible old_ip=`cat db.bind | grep example.org. | grep "IN A"` if [ "$useip" != "$ip_address" ]; then # #Change ip address and update bind serial # echo $ip_address > useip #Get the serial line to replace in sed replace_serial=`cat db.bind | grep Serial` echo Replace Serial: $replace_serial #Generate new serial new_serial=`date +"%m%d%Y"` #Add Serial prefix to end of Serial new_serial="$new_serial ; Serial" echo New Serial: $new_serial #Replace the serial with the updated Serial number sed -i "/$replace_serial/ c\ $new_serial" db.bind #Replace the old ip address with the new ip address sed -i "/$old_ip/ c\be-rad.duckdns.org. IN A $ip_address " db.bind #Restart command for solaris/Open Indaina svcadm restart svc:/network/dns/server:default #Check to see if its online service_check=`svcs -xv /network/dns/server:default` # #LOG features # echo ON [`date | cut -b 1-23`] >> $log echo The following has been changed: echo Old IP: $useip >> $log echo New IP: $ip_address >> $log echo "Service Check: $service_check " >> $log else # #LOG features # echo ON [`date | cut -b 1-23`] >> $log echo The ip address did not change >> $log echo " " >> $log fi