首页 > 其他 > 详细

batch configure ip address

时间:2018-02-06 10:11:03      阅读:224      评论:0      收藏:0      [点我收藏+]
RETVAL=0
oper(){
if [ "$1" == "del" ];then
list=echo{10..1}
else
list=echo{1..10}
fi
for ip in $list;do
if [ $ip -eq 5 ];then
continue
fi
ip addr $1 192.168.1.$ip/14 dev eth0 label eth0:$ip &>/dev/null
RETVAL=$?
if [ $RETVAL -eq 0 ];then
action "$1 $ip" /bin/true
else
action "$1 $ip" /bin/false
fi
done
return $RETVAL
}

case "$1" in
start)
oper add
RETVAL=$?
;;
stop)
oper del
RETVAL=$?
;;
restart)
oper del
sleep 2
oper add
RETVAL=$?
;;
*)
printf "USAGE:$0 {start|stop|restart}\n"
esac
exit $RETVAL

batch configure ip address

原文:http://blog.51cto.com/546136/2069254

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!