Clommunity / cloudynitzar

A tool to convert your Debian system into a Commnunity Networking cloud in a box
http://cloudy.community
5 stars 3 forks source link

bug in /etc/init.d/serf #8

Closed felixfreitag closed 6 years ago

felixfreitag commented 6 years ago

Serf does not start from cloudynitzar.sh because PUBLIC_IP is not found in /etc/init.d/serf:

ip addr show dev eth0 called from /etc/init.d/serf can have the work "dynamic" or not between "global" and "eth0". (below examples cloudy4 and cloudy5)

but in /etc/init.d/serf the condition PUBLIC_IP=$(ip addr show dev $SERF_INTERFACE|grep "global.* $SERF_INTERFACE\$"|awk '{print $2}'|awk -F "/" {'print $1'})

only works for the case without "dynamic" (case cloudy5), in case of cloudy4 the variable PUBLIC_IP is empty (because of "dynamic") and serf does not start.

It seems using PUBLIC_IP=$(ip addr show dev $SERF_INTERFACE|grep "global.*"|awk '{print $2}'|awk -F "/" {'print $1'}) without $SERF_INTERFACE\$ would capture the same line.

Cases: Cloudy4 does not work, cloudy5 works.

root@cloudy4:/etc/init.d# ip addr show dev eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:50:56:1c:01:0f brd ff:ff:ff:ff:ff:ff inet 147.83.42.141/24 brd 147.83.42.255 scope global dynamic eth0 valid_lft 3429sec preferred_lft 3429sec inet6 fe80::250:56ff:fe1c:10f/64 scope link valid_lft forever preferred_lft forever root@cloudy4:/etc/init.d#

root@cloudy5:/etc/init.d# ip addr show dev eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:50:56:1c:01:2b brd ff:ff:ff:ff:ff:ff inet 147.83.42.188/24 brd 147.83.42.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::250:56ff:fe1c:12b/64 scope link valid_lft forever preferred_lft forever root@cloudy5:/etc/init.d#

rogerpueyo commented 6 years ago

ip -4 -o addr show up primary scope global eth0 | sed 's/ */ /g' | cut -d '/' -f1 | grep -o '[^ ]*$'

rogerpueyo commented 6 years ago

Fixed in commit https://github.com/Clommunity/package-serf/commit/d71b412db07042127e46c847084686a0da87f080