From fcd1799e944ee491666a655da6cba31c71fd2460 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 9 Aug 2015 22:44:41 +0100 Subject: [PATCH] Hack to work around erratic avahi-daemon behavior --- src/freedombone | 7 +++++++ src/freedombone-client | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/freedombone b/src/freedombone index 0f1b785f..bafac4ab 100755 --- a/src/freedombone +++ b/src/freedombone @@ -1698,6 +1698,13 @@ function configure_avahi { echo '' >> /etc/avahi/services/irc.service systemctl restart avahi-daemon + + # this is a blatant hack, but I couldn't find a better way of mitigating the problem + # of avahi-daemon stopping after a few minutes + if ! grep -q "avahi-daemon" /etc/crontab; then + echo '2 * * * * root systemctl restart avahi-daemon' >> /etc/crontab + fi + echo 'configure_avahi' >> $COMPLETION_FILE } diff --git a/src/freedombone-client b/src/freedombone-client index 164a53cd..9753d4e3 100755 --- a/src/freedombone-client +++ b/src/freedombone-client @@ -118,6 +118,9 @@ function mesh_babel { echo ' apt-get -y install avahi-utils avahi-autoipd avahi-daemon avahi-dnsconfd' >> $babel_script echo ' sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script echo ' sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script + echo ' if ! grep -q "avahi-daemon" /etc/crontab; then' >> $babel_script + echo " echo '2 * * * * root systemctl restart avahi-daemon' >> /etc/crontab" >> $babel_script + echo ' fi' >> $babel_script echo ' if [ -f /bin/systemctl ]; then' >> $babel_script echo ' systemctl restart avahi-daemon' >> $babel_script echo ' else' >> $babel_script @@ -195,6 +198,9 @@ function mesh_batman { echo ' sed -i "s|use-ipv4=.*|use-ipv4=yes|g" /etc/avahi/avahi-daemon.conf' >> $batman_script echo ' sed -i "s|use-ipv6=.*|use-ipv6=no|g" /etc/avahi/avahi-daemon.conf' >> $batman_script echo ' sed -i "s|hosts:.*|hosts: files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf' >> $batman_script + echo ' if ! grep -q "avahi-daemon" /etc/crontab; then' >> $batman_script + echo " echo '2 * * * * root systemctl restart avahi-daemon' >> /etc/crontab" >> $batman_script + echo ' fi' >> $batman_script echo 'fi' >> $batman_script echo '' >> $batman_script echo '# Mesh definition' >> $batman_script