服务如何禁用avahi守护进程?

分享于 

4分钟阅读

ubuntu

  繁體

问题

如何禁用avahi守护进程?

在每次引导时,/sbin/init启动一个avahi-daemon的进程


# initctl list | grep avahi


avahi-daemon start/running, process 1280




# id avahi


uid=107(avahi) gid=118(avahi) groups=118(avahi)



initctl list | sort

我可以通过以下命令暂时停止"服务":


service avahi-daemon stop




/etc/init.d/avahi-daemon stop




env -i LANG="$LANG" PATH="$PATH" TERM="$TERM""$SERVICEDIR/$SERVICE"



在Ubuntu,如何禁用服务?


update-rc.d avahi-daemon disable



但是它抱怨:


System start/stop links for /etc/init.d/avahi-daemon do not exist



我搜索了二进制文件的路径:


# Let me know if there is a better way to get the path above


readlink"/proc/$(echo `ps --no-headers -o pid -C avahi-daemon | head -n 1`)/exe"




/usr/sbin/avahi-daemon




find /etc -type f -name '*avahi*' -perm -u+x



/etc/rcN.d中找到启动脚本,


/etc/dhcp/dhclient-exit-hooks.d/zzz_avahi-autoipd


/etc/dhcp/dhclient-enter-hooks.d/avahi-autoipd


/etc/resolvconf/update-libc.d/avahi-daemon


/etc/network/if-up.d/avahi-autoipd


/etc/network/if-up.d/avahi-daemon


/etc/network/if-down.d/avahi-autoipd


/etc/avahi/avahi-autoipd.action




lsof -p $(echo `ps --no-headers -o pid -C avahi-daemon | head -n 1`)




for i in {1..59}; do ps -p $(echo `ps --no-headers -o pid -C avahi-daemon | head -n 1`) --no-headers -o pcpu; sleep 1; done




答案1

Upstart启动脚本存在于/etc/init中,你可以找到avahi-daemon.conf

#添加到start on行,或使用override文件(例子:sudo sh -c"echo manual > /etc/init/avahi-daemon.override" )。


答案2


sudo systemctl disable avahi-daemon



在Ubuntu Gnome 15.10上正常工作


答案3

我发现即使停止了avahi-daemon (和avahi-daemon.socket ),Firefox总是重新启动它,但这可以工作,并且永久禁用这个烦人的守护进程:


apt-get remove avahi-daemon




答案4

/etc/init/avahi-daemon.conf注释掉respawn



服务  services  Daemon  Avahi