houxiao
2017-04-25 101679ef6d0298cf58a7b8bc26af78e10e279c61
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
 
#crontab:
#*/2 * * * * /bin/sh /opt/auto-net-ip.sh > /dev/null 2>&1
 
HAS_NET=`ifconfig | grep enp1s0 -A 1 | grep 172.16`
 
if [ -z "$HAS_NET" ]; then
    echo "set ip address"
    ifconfig enp1s0 172.16.24.10/16
    ifconfig enp2s0 192.168.1.100/24
fi