annotate contrib/guess-hostname @ 160:60c92aa59911

added a script to guess the host's name
author meillo@marmaro.de
date Thu, 08 Jul 2010 11:27:03 +0200 (2010-07-08)
parents
children 71dcdc2020bc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
160
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
1 #!/bin/sh
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
2 #
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
3 # try several ways to guess the hostname
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
4
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
5 (
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
6
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
7 # this is what Debian uses
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
8 cat /etc/mailname
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
9
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
10 # this is often the short hostname
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
11 cat /etc/hostname
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
12
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
13 # this file was mentioned on the Internet
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
14 cat /etc/HOSTNAME
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
15
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
16 # probably a good value on GNU/Linux
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
17 hostname -f
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
18
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
19 # often the short hostname, but widely available
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
20 hostname
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
21
60c92aa59911 added a script to guess the host's name
meillo@marmaro.de
parents:
diff changeset
22 ) 2>/dev/null | sort -u