背景:
需要固定ip地址,并且能夠自動啟動可執行文件。
流程:
1.在/etc/network/interfaces 中添加
auto eth0
iface eth0 inet staticaddress 192.168.1.100netmask 255.255.255.0gateway 192.168.1.1
2.將下面這行代碼添加自動啟動腳本
/etc/init.d/networking restart
這里/etc/inin.d/下的networking 可能對應不同的固件,名字不一樣。比如1126中的就是
/etc/inin.d/S40network
自動執行腳本,在終端輸入下面命令:
vi /etc/profile
...
/etc/init.d/networking restart
/home/.../start.sh
注意先配置ip,再啟動程序,否則程序里可能會連不上。