2

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?

DrStalker
  • 6,946
  • 24
  • 79
  • 107

1 Answers1

2

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.

David Harrison
  • 441
  • 2
  • 5