2011-12-07 22:59:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ ! $UID -eq 0 ]; then
|
|
|
|
sudo $0 $1
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo $1 > /etc/hostname
|
|
|
|
cat /etc/hosts | sed "s#^\\(127.0.0.1\\)\\(.*\\)\$#\\1 $1 \\2#g" > /etc/hosts.tmp
|
|
|
|
mv /etc/hosts.tmp /etc/hosts
|
|
|
|
hostname $1
|
|
|
|
|
2012-01-18 17:29:05 +00:00
|
|
|
if [ -f /etc/sysconfig/network ]; then
|
|
|
|
echo -e "NETWORKING=yes\nHOSTNAME=$1\n" > /etc/sysconfig/network
|
|
|
|
fi
|
|
|
|
|
2011-12-07 22:59:34 +00:00
|
|
|
echo "Server renamed to $1"
|
|
|
|
|