Checking DNS records of a specific nameserver

I’m migrating a site from GoDaddy to HostGator (I personally would prefer to move over AWS but that’s the client’s choice in this specific case) and I wanted to get the IP of the new server on HostGator. I couldn’t find the IP anywhere on their control panel. Pinging the temporary URL they provide for testing was returning a different address — I suspect they have some kind of proxy in place for this temp URLs.

I know the host command could give me the DNS settings, which would include the A record with the IP address. However, the domain was still set to use GoDaddy’s nameservers (NS). Running host "name.tld" would give me the DNS records from GoDaddy. However, I was wondering if I could run the command against a specific nameserver. It makes sense having a way to look for records that way, right?

Looking at the man page for host command, there is a server argument. The signature looks like host [options] host [server]. So, I ended up running:

host -a "name.tld" "new.nameserver.tld"

And, voilà! I got the IP address for the new web server.

Got questions? Feel free to comment below.


Script de deploy para projetos que usam git

Há alguns meses atrás desenvolvi um script de deploy para um projeto em que estou trabalhando. Com o tempo vi a possibilidade de melhorar alguns pontos, especialmente com o uso do componente Console do Symfony2,  e agora disponibilizo uma versão pública que pode ser usada com projetos armazenados em um repositório git.

Uma das limitações dessa versão é que ela trabalha apenas com SSH, mas em breve devo adicionar suporte a FTP.

Recursive chmod

Sometimes you need to change the access control to files matching some requirement. E.g. today I needed grant execute access to the owner of all PHP scripts running under Apache HTTP Server, in a specific directory.

Continue reading “Recursive chmod”

Writing an init script for a Java application

UPDATE, Oct, 1st 2014

This is an old post (from 5 years ago when I writing this update) and the solution isn’t the best. So take a look at the comments – specially that one by Tinoco.

The need make us study topics we think we’ll never need. Today I had to write a simple bash program to start (and stop) a Java application, a simple init script.

After much searching, I’ve found some simple explanations for some specific points of the bash script syntax.

I don’t know who is on the right side of this story, but seems that professionals who write manuals and tutorials for this language doesn’t think like common web programmers, such as Java or PHP programmers. I sought to much on Google to find things like how I could associate the returning value of a function to a variable.

But finally, I’ll leave aside the claims and move to example:

Continue reading “Writing an init script for a Java application”

Using Apache James to send e-mail from a Windows desktop

I use Windows at work and it doesn’t have sendmail program, like Linux or Mac. With Windows XP, there is the IIS built-in SMTP service. But, yet I use Apache Server and not IIS.

Until recently I had a hard time testing applications that send e-mails. But then I found the Apache James project. Despite some issues that I have with PHPMailer specific settings, it works just fine. Continue reading “Using Apache James to send e-mail from a Windows desktop”