批量修改hosts sh脚本
【摘要】
#!/bin/sh
echo "Enter User password ::"$cond2
read cond2
if [ -z "$cond2" ]
then
echo Your password file configuration successfully skiped..................
else
echo "...
#!/bin/sh
echo "Enter User password ::"$cond2
read cond2
if [ -z "$cond2" ]
then
echo Your password file configuration successfully skiped..................
else
echo "$cond2" > pas.txt
echo Your password file configuration successfully finced..................
fi
echo '#!/bin/sh' > st.sh
echo 'b=$(hostname)' >> st.sh
echo 'c=$(ifconfig eth0 | grep "inet addr" | cut -d':' -f2 | cut -d' ' -f1 )' >> st.sh
echo 'echo $c $b > 1' >> st.sh
chmod +x st.sh
cat pas.txt | sudo -S mv st.sh /opt/
cat pas.txt | sudo -S cp /var/spool/cron/crontabs/root .
cat pas.txt | sudo -S chown $a root
echo '@reboot /opt/st.sh' >> root
cat pas.txt | sudo -S chown root root
cat pas.txt | sudo -S chmod 0600 root
cat pas.txt | sudo -S mv root /var/spool/cron/crontabs/root
https://github.com/tonyreddy/Chanage_hostname/blob/master/Hostname_Change.sh
文章来源: blog.csdn.net,作者:隔壁老瓦,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/wxb880114/article/details/99454902
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)