Em vez de modificar o script de inicialização, investigue quais opções de depuração já são fornecidas com o software.
Você não especificou qual distribuição Linux você está usando. No entanto, posso sugerir o seguinte com base no CentOS 6:
1: a página man do named
mostra essas opções de depuração para o daemon nomeado:
-d debug-level Set the daemon’s debug level to debug-level. Debugging traces from named become more verbose as the debug level increases. -g Run the server in the foreground and force all logging to stderr.
2: a maneira correta de passar essas opções para o daemon é modificar /etc/sysconfig/named
e especificar quais opções de linha de comando você precisa passar para o daemon na variável OPTIONS. O arquivo /etc/sysconfig/named
é originado no script de inicialização, antes de executar o daemon named
.
Procure a linha com OPTIONS =, descomente-a e edite-a para mostrar o seguinte:
OPTIONS="-g"
3: Agora inicie o daemon usando o script de inicialização; o script deve ficar em primeiro plano e a saída do daemon deve aparecer na janela.
Aqui está um exemplo do efeito de ativar a opção "-g" no meu teste:
Sem qualquer modificação para OPTIONS:
[user@mycentos6box ~]# /etc/init.d/named start
Starting named: [ OK ]
[user@mycentos6box ~]#
Modificando OPÇÕES conforme acima:
[user@mycentos6box ~]# /etc/init.d/named start
Starting named: 24-Nov-2014 20:23:28.963 starting BIND 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 -u named -g
24-Nov-2014 20:23:28.963 built with '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-libtool' '--localstatedir=/var' '--enable-threads' '--enable-ipv6' '--with-pic' '--disable-static' '--disable-openssl-version-check' '--with-dlz-ldap=yes' '--with-dlz-postgres=yes' '--with-dlz-mysql=yes' '--with-dlz-filesystem=yes' '--with-gssapi=yes' '--disable-isc-spnego' '--with-docbook-xsl=/usr/share/sgml/docbook/xsl-stylesheets' '--enable-fixed-rrset' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS= -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'CPPFLAGS= -DDIG_SIGCHASE'
24-Nov-2014 20:23:28.963 ----------------------------------------------------
24-Nov-2014 20:23:28.963 BIND 9 is maintained by Internet Systems Consortium,
24-Nov-2014 20:23:28.963 Inc. (ISC), a non-profit 501(c)(3) public-benefit
24-Nov-2014 20:23:28.963 corporation. Support and training for BIND 9 are
24-Nov-2014 20:23:28.963 available at https://www.isc.org/support
24-Nov-2014 20:23:28.963 ----------------------------------------------------
24-Nov-2014 20:23:28.964 adjusted limit on open files from 4096 to 1048576
24-Nov-2014 20:23:28.964 found 2 CPUs, using 2 worker threads
24-Nov-2014 20:23:28.964 using up to 4096 sockets
24-Nov-2014 20:23:28.967 loading configuration from '/etc/named.conf'
24-Nov-2014 20:23:28.967 reading built-in trusted keys from file '/etc/named.iscdlv.key'
24-Nov-2014 20:23:28.967 using default UDP/IPv4 port range: [1024, 65535]
24-Nov-2014 20:23:28.968 using default UDP/IPv6 port range: [1024, 65535]
24-Nov-2014 20:23:28.969 listening on IPv4 interface lo, 127.0.0.1#53
24-Nov-2014 20:23:28.970 generating session key for dynamic DNS
24-Nov-2014 20:23:28.970 sizing zone task pool based on 6 zones
24-Nov-2014 20:23:28.972 using built-in DLV key for view _default
24-Nov-2014 20:23:28.973 set up managed keys zone for view _default, file '/var/named/dynamic/managed-keys.bind'
24-Nov-2014 20:23:28.973 Warning: 'empty-zones-enable/disable-empty-zone' not set: disabling RFC 1918 empty zones
24-Nov-2014 20:23:28.973 automatic empty zone: 127.IN-ADDR.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: 254.169.IN-ADDR.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: 2.0.192.IN-ADDR.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: 100.51.198.IN-ADDR.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: 113.0.203.IN-ADDR.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: 255.255.255.255.IN-ADDR.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: D.F.IP6.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: 8.E.F.IP6.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: 9.E.F.IP6.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: A.E.F.IP6.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: B.E.F.IP6.ARPA
24-Nov-2014 20:23:28.973 automatic empty zone: 8.B.D.0.1.0.0.2.IP6.ARPA
24-Nov-2014 20:23:28.975 none:0: open: /etc/rndc.key: permission denied
24-Nov-2014 20:23:28.975 couldn't add command channel 127.0.0.1#953: permission denied
24-Nov-2014 20:23:28.975 none:0: open: /etc/rndc.key: permission denied
24-Nov-2014 20:23:28.975 couldn't add command channel ::1#953: permission denied
24-Nov-2014 20:23:28.975 ignoring config file logging statement due to -g option
24-Nov-2014 20:23:28.975 zone 0.in-addr.arpa/IN: loaded serial 0
24-Nov-2014 20:23:28.976 zone 1.0.0.127.in-addr.arpa/IN: loaded serial 0
24-Nov-2014 20:23:28.976 zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0
24-Nov-2014 20:23:28.977 zone localhost.localdomain/IN: loaded serial 0
24-Nov-2014 20:23:28.977 zone localhost/IN: loaded serial 0
24-Nov-2014 20:23:28.977 managed-keys-zone ./IN: loaded serial 1
24-Nov-2014 20:23:28.979 error (network unreachable) resolving './DNSKEY/IN': 2001:503:ba3e::2:30#53
24-Nov-2014 20:23:28.979 error (network unreachable) resolving './NS/IN': 2001:503:ba3e::2:30#53
24-Nov-2014 20:23:28.979 error (network unreachable) resolving 'dlv.isc.org/DNSKEY/IN': 2001:500:2f::f#53
24-Nov-2014 20:23:28.979 error (network unreachable) resolving './DNSKEY/IN': 2001:500:2f::f#53
24-Nov-2014 20:23:28.979 error (network unreachable) resolving './NS/IN': 2001:500:2f::f#53
24-Nov-2014 20:23:28.979 running
Eu posso pressionar CTRL-C para parar o daemon:
^C
24-Nov-2014 20:23:34.247 shutting down
24-Nov-2014 20:23:34.248 no longer listening on 127.0.0.1#53
24-Nov-2014 20:23:34.250 exiting
[ OK ]
[user@mycentos6box ~]#