需求:启动linux是需要添加自定义ip地址到eth0网卡
在/etc/rc.d/init.d目录下编辑auto_run文本:
#!/bin/bash
#add ip eth0ip addr add 10.8.2.1/32 dev eth0
添加auto_run服务: chkconfig --add auto_run
报错:
service auto_run does not support chkconfig
经过查证后才知需要添加两句代码:
#chkconfig: - 85 15
#description: nginx is a World Wide Web server. It is used to serve
修改后:
#!/bin/bash
#add ip eth0#chkconfig: - 85 15
#description: nginx is a World Wide Web server. It is used to serve
ip addr add 10.8.2.1/32 dev eth0
添加auto_run:
chkconfig --add auto_run
成功!
设置auto_run服务开机自启动:
chkconfig auto_run on