find 命令在早上每次新启动时都会运行 - debian stretch

Bus*_*ler 2 find webserver background-process daemon

各位,

find由 nobody 执行在每次新启动时自动运行(在我启动系统的早晨)。我猜这与updatedb. 我如何确认我的假设并阻止它自动执行。我的ps aux | grep find输出如下:

~~> ps aux | grep find
root      4492  0.0  0.0   4288   748 ?        SN   08:10   0:00 /bin/sh /usr/bin/updatedb.findutils
root      4500  0.0  0.0   4288   108 ?        SN   08:10   0:00 /bin/sh /usr/bin/updatedb.findutils
root      4526  0.0  0.0  55444  2988 ?        SN   08:10   0:00 su nobody -s /bin/sh -c /usr/bin/find / -ignore_readdir_race      \( -fstype NFS -o -fstype nfs -o -fstype nfs4 -o -fstype afs -o -fstype binfmt_misc -o -fstype proc -o -fstype smbfs -o -fstype autofs -o -fstype iso9660 -o -fstype ncpfs -o -fstype coda -o -fstype devpts -o -fstype ftpfs -o -fstype devfs -o -fstype mfs -o -fstype shfs -o -fstype sysfs -o -fstype cifs -o -fstype lustre_lite -o -fstype tmpfs -o -fstype usbfs -o -fstype udf -o -fstype ocfs2 -o      -type d -regex '\(^/tmp$\)\|\(^/usr/tmp$\)\|\(^/var/tmp$\)\|\(^/afs$\)\|\(^/amd$\)\|\(^/alex$\)\|\(^/var/spool$\)\|\(^/sfs$\)\|\(^/media$\)\|\(^/var/lib/schroot/mount$\)' \) -prune -o -print0
nobody    4538  0.0  0.0   4288   748 ?        SNs  08:10   0:00 sh -c /usr/bin/find / -ignore_readdir_race      \( -fstype NFS -o -fstype nfs -o -fstype nfs4 -o -fstype afs -o -fstype binfmt_misc -o -fstype proc -o -fstype smbfs -o -fstype autofs -o -fstype iso9660 -o -fstype ncpfs -o -fstype coda -o -fstype devpts -o -fstype ftpfs -o -fstype devfs -o -fstype mfs -o -fstype shfs -o -fstype sysfs -o -fstype cifs -o -fstype lustre_lite -o -fstype tmpfs -o -fstype usbfs -o -fstype udf -o -fstype ocfs2 -o      -type d -regex '\(^/tmp$\)\|\(^/usr/tmp$\)\|\(^/var/tmp$\)\|\(^/afs$\)\|\(^/amd$\)\|\(^/alex$\)\|\(^/var/spool$\)\|\(^/sfs$\)\|\(^/media$\)\|\(^/var/lib/schroot/mount$\)' \) -prune -o -print0
nobody    4539  7.9  0.0  16844  2752 ?        DN   08:10   0:06 /usr/bin/find / -ignore_readdir_race ( -fstype NFS -o -fstype nfs -o -fstype nfs4 -o -fstype afs -o -fstype binfmt_misc -o -fstype proc -o -fstype smbfs -o -fstype autofs -o -fstype iso9660 -o -fstype ncpfs -o -fstype coda -o -fstype devpts -o -fstype ftpfs -o -fstype devfs -o -fstype mfs -o -fstype shfs -o -fstype sysfs -o -fstype cifs -o -fstype lustre_lite -o -fstype tmpfs -o -fstype usbfs -o -fstype udf -o -fstype ocfs2 -o -type d -regex \(^/tmp$\)\|\(^/usr/tmp$\)\|\(^/var/tmp$\)\|\(^/afs$\)\|\(^/amd$\)\|\(^/alex$\)\|\(^/var/spool$\)\|\(^/sfs$\)\|\(^/media$\)\|\(^/var/lib/schroot/mount$\) ) -prune -o -print0
cathyserver  5223  0.0  0.0  13380   940 pts/1    S+   08:12   0:00 grep find
Run Code Online (Sandbox Code Playgroud)

第一印象是某个守护进程正在寻找/var /tmp /var/spool /alex /amd /afs /var/tmp某些东西。如何找到执行此操作的进程/守护程序?这是任何网络服务器吗?顺便说一下/alex /amd,我的系统中没有任何目录。

Mar*_*vin 5

find是确实的部分updatedb,它每天运行,通过触发cron守护进程。

您可以通过将find进程列表中的参数与 中的配置进行比较来进行验证/etc/updatedb.conf

在 Debian Stretch 上,您可以在替代品和之间切换locate及其相应的updatedb命令:mlocatelocate.findutils

sudo apt install mlocate locate
sudo update-alternatives --config locate
Run Code Online (Sandbox Code Playgroud)

移动

cron守护进程使用/etc/cron.daily/mlocate.

要禁用每日运行,您可以mlocate通过删除执行权限来卸载包或禁用其 cron 作业:

sudo chmod -x /etc/cron.daily/mlocate
Run Code Online (Sandbox Code Playgroud)

要重新启用它:

sudo chmod +x /etc/cron.daily/mlocate
Run Code Online (Sandbox Code Playgroud)

locate.findutils

cron守护进程使用/etc/cron.daily/locate.

要禁用每日运行,您可以locate通过删除执行权限来卸载包或禁用其 cron 作业:

sudo chmod -x /etc/cron.daily/locate
Run Code Online (Sandbox Code Playgroud)

要重新启用它:

sudo chmod +x /etc/cron.daily/locate
Run Code Online (Sandbox Code Playgroud)

禁用/启用行的来源:https : //askubuntu.com/questions/268130/can-i-disable-updatedb-mlocate