Mercurial > sat_docs
diff scripts/dns_srv/configure_dns_srv.sh @ 3:73d3b94b7364
added DNS SRV configuration script + move launching script to scripts/launcher/launch.sh
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 27 Jun 2014 19:17:18 +0200 |
parents | |
children | a6af040be754 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/dns_srv/configure_dns_srv.sh Fri Jun 27 19:17:18 2014 +0200 @@ -0,0 +1,34 @@ +#!/bin/bash + +# This script allows you to quickly change your bind9 configuration: +# - define an internal domain and bind it to 127.0.0.1 +# - add SRV records to use this domain with your local XMPP server +# +# BE SURE TO BACKUP /etc/bind AND /var/cache/bind BEFORE USING THIS SCRIPT! +# +# Configuration files based on: +# - http://www.madboa.com/geek/soho-bind +# - http://wiki.xmpp.org/web/SRV_Records +# - http://prosody.im/doc/dns +# +# For this to work, Prosody configuration must define the domain as a VirtualHost. +# It is also assumed that the Prosody "directory" option is set to "/var/cache/bind". + +if [ $# -lt 2 ]; then + echo "Usage: `basename $0` <domain> <c2s_port>" + exit 1 +fi + +HOSTNAME=`cat /etc/hostname` +DOMAIN=$1 +C2S_PORT=$2 +DATE=`date +%s` + +mkdir -p /tmp/$DATE/ +cp -r template/* /tmp/$DATE/ +cd /tmp/$DATE +for FILE in `find . -type f`; do + sed -e s/\<domain\>/$DOMAIN/g -e s/\<hostname\>/$HOSTNAME/g -e s/\<date\>/$DATE/g -e s/\<c2s_port\>/$C2S_PORT/g $FILE > `echo $FILE | sed -e 's/^.//' -e s/my.domain/$DOMAIN/` +done +/etc/init.d/bind9 restart +tail /var/log/syslog