I have a linux (CentOS 5.2) server with the name myserver.mycompnay.com, which is correctly returned when I run 'hostname'. When I run 'hostname -s' however it returns "localhost" which is causing some backup scripts to put stuff in a "localhost" directory instead of a "myserver" directory.

All of our other CentOS boxes correctly return the first part of their hostname when 'hostname -s', where do I go on this server to make it behave the same? Other than having "HOSTNAME=myserver.mycompnay.com" in /etc/sysconfig/network what should I be looking at?

link|improve this question

feedback

1 Answer

up vote 2 down vote accepted

Checkout your /etc/hosts file. It should go something like:

127.0.0.1   myserver.mycompany.com   myserver  localhost.localdomain   localhost
::1     localhost6.localdomain6 localhost6

If you do not have myserver by itself, or localhost comes before it, things maybe getting confused.

link|improve this answer
That was it, thanks. – DrStalker Mar 15 '10 at 6:41
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.