标签:ipa man config pad cat host cobbler 自身 href
参考:https://cobbler.github.io/manuals/2.6.0/3/1/3_-_Systems.html脚本:
#[root@dns1 html]# cat change_hostname7.sh
#!/bin/sh
IPADDR=$(/sbin/ifconfig eth0|grep -w ‘inet‘|awk ‘{print $2}‘)
if [[ $IPADDR == 10.10.24.70 ]];then
echo "change hostname to LA-CEN-TOM-JT-24-17"
echo "LA-CEN-TOM-JT-24-70">/etc/hostname
hostnamectl set-hostname LA-CEN-TOM-JT-24-70
elif [[ $IPADDR == 10.10.24.18 ]];
then
hostnamectl set-hostname "LA-RED-TOM-JT-24-18"
elif [[ $IPADDR == 10.10.24.88 ]];
then
hostnamectl set-hostname "LA-RED-REDIS-JT-24-88"
elif [[ $IPADDR == 10.10.24.89 ]];
then
hostnamectl set-hostname "LA-RED-RABBIT-JT-24-89"
elif [[ $IPADDR == 10.10.24.87 ]];
then
hostnamectl set-hostname "LA-NGINX-TOM-JT-24-87"
elif [[ $IPADDR == 10.10.24.86 ]];
then
hostnamectl set-hostname "LA-RED-TOM2-JT-24-86"
elif [[ $IPADDR == 10.10.24.85 ]];
then
hostnamectl set-hostname "LA-RED-MON-JCJ-24-85"
elif [[ $IPADDR == 10.10.24.84 ]];
then
hostnamectl set-hostname "LA-RED-MYSQL-JT-24-84"
else
echo "NO HOSTNAME SET, USE DEFAULT"
hostnamectl set-hostname $IPADDR
fi
cobbler自动化安装系统无法修改centos7的主机名问题
标签:ipa man config pad cat host cobbler 自身 href
原文地址:https://blog.51cto.com/mrdeng/2429323