Ensure that the avahi daemon keeps running
This commit is contained in:
parent
989c48f88b
commit
fc004e746f
|
@ -111,7 +111,7 @@ function mesh_avahi {
|
|||
WATCHDOG_SCRIPT_NAME="keepon"
|
||||
{ echo '';
|
||||
echo '# keep avahi daemon running';
|
||||
echo "AVAHI_RUNNING=\$(pgrep avahi-daemon > /dev/null && echo Running)";
|
||||
echo "AVAHI_RUNNING=\$(systemctl is-active avahi-daemon >/dev/null 2>&1 && echo Running)";
|
||||
echo "if [ ! \$AVAHI_RUNNING ]; then";
|
||||
echo ' systemctl start avahi-daemon';
|
||||
echo " echo -n \$CURRENT_DATE >> \$LOGFILE";
|
||||
|
@ -150,6 +150,25 @@ function install_avahi {
|
|||
sed -i 's|#domain-name=.*|domain-name=local|g' /etc/avahi/avahi-daemon.conf
|
||||
sed -i 's|domain-name=.*|domain-name=local|g' /etc/avahi/avahi-daemon.conf
|
||||
|
||||
# keep the daemon running
|
||||
WATCHDOG_SCRIPT_NAME="keepon"
|
||||
if [ ! -f "/usr/bin/$WATCHDOG_SCRIPT_NAME" ]; then
|
||||
{ echo '#!/bin/bash';
|
||||
echo 'LOGFILE=/var/log/keepon.log';
|
||||
echo "CURRENT_DATE=\$(date)"; } > "/usr/bin/$WATCHDOG_SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
{ echo '';
|
||||
echo '# keep avahi daemon running';
|
||||
echo "AVAHI_RUNNING=\$(systemctl is-active avahi-daemon >/dev/null 2>&1 && echo Running)";
|
||||
echo "if [ ! \$AVAHI_RUNNING ]; then";
|
||||
echo ' systemctl start avahi-daemon';
|
||||
echo " echo -n \$CURRENT_DATE >> \$LOGFILE";
|
||||
echo " echo \" Avahi daemon restarted\" >> \$LOGFILE";
|
||||
echo 'fi';
|
||||
echo '# End of avahi'; } >> "/usr/bin/$WATCHDOG_SCRIPT_NAME"
|
||||
chmod +x "/usr/bin/$WATCHDOG_SCRIPT_NAME"
|
||||
|
||||
mark_completed "${FUNCNAME[0]}"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue