# help: why is find running in the background?



## mdg583 (Mar 2, 2010)

Hello, I was wondering if anyone can help me find out why 'find' sometimes starts running in the background on my desktop freebsd system. I've assumed it is some system thing - I only notice it every once in a while (week or so).


```
last pid:  3485;  load averages:  1.03,  0.73,  0.69    up 0+02:22:32  03:05:18
167 processes: 4 running, 163 sleeping
CPU:     % user,     % nice,     % system,     % interrupt,     % idle
Mem: 607M Active, 46M Inact, 280M Wired, 21M Cache, 109M Buf, 25M Free
Swap: 1995M Total, 1496K Used, 1994M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
 3458 root          1  62    0  5332K  2928K RUN     0   0:30 23.78% find
 1167 root          1  58    0   368M   350M CPU1    1  18:19 16.70% Xorg
```

Any ideas what could be running it? I don't have any reason to be concerned, I hope.

The last 1/2 hour of /var/log/cron:

```
Mar  2 02:30:00 matt-freebsd /usr/sbin/cron[3108]: (root) CMD (/usr/libexec/atrun)
Mar  2 02:31:00 matt-freebsd /usr/sbin/cron[3128]: (root) CMD (adjkerntz -a)
Mar  2 02:33:00 matt-freebsd /usr/sbin/cron[3133]: (operator) CMD (/usr/libexec/save-entropy)
Mar  2 02:35:00 matt-freebsd /usr/sbin/cron[3157]: (root) CMD (/usr/libexec/atrun)
Mar  2 02:40:00 matt-freebsd /usr/sbin/cron[3211]: (root) CMD (/usr/libexec/atrun)
Mar  2 02:44:00 matt-freebsd /usr/sbin/cron[3228]: (operator) CMD (/usr/libexec/save-entropy)
Mar  2 02:45:00 matt-freebsd /usr/sbin/cron[3240]: (root) CMD (/usr/libexec/atrun)
Mar  2 02:50:01 matt-freebsd /usr/sbin/cron[3253]: (root) CMD (/usr/libexec/atrun)
Mar  2 02:55:00 matt-freebsd /usr/sbin/cron[3310]: (root) CMD (/usr/libexec/atrun)
Mar  2 02:55:00 matt-freebsd /usr/sbin/cron[3309]: (operator) CMD (/usr/libexec/save-entropy)
Mar  2 03:00:00 matt-freebsd /usr/sbin/cron[3328]: (root) CMD (newsyslog)
Mar  2 03:00:00 matt-freebsd /usr/sbin/cron[3329]: (root) CMD (/usr/libexec/atrun)
Mar  2 03:00:00 matt-freebsd /usr/sbin/cron[3330]: (operator) CMD (/usr/libexec/save-entropy)
Mar  2 03:01:00 matt-freebsd /usr/sbin/cron[3344]: (root) CMD (periodic daily)
Mar  2 03:01:00 matt-freebsd /usr/sbin/cron[3343]: (root) CMD (adjkerntz -a)
Mar  2 03:05:00 matt-freebsd /usr/sbin/cron[3481]: (root) CMD (/usr/libexec/atrun)
Mar  2 03:10:00 matt-freebsd /usr/sbin/cron[3697]: (root) CMD (/usr/libexec/atrun)
Mar  2 03:11:01 matt-freebsd /usr/sbin/cron[3699]: (operator) CMD (/usr/libexec/save-entropy)
```

Maybe it's something in periodic daily? mostly just curious.


----------



## graudeejs (Mar 2, 2010)

find is used in many daily scripts

```
# cd /etc/periodic
# grep -e find */*
daily/100.clean-disks:	    rc=$(find / \( ! -fstype local -o -fstype rdonly \) -prune -o \
daily/110.clean-tmps:			find -d . -type f $args -delete $print
daily/110.clean-tmps:			find -d . ! -name . -type d $dargs -delete $print
daily/120.clean-preserve:		rc=$(find . ! -name . -mtime +$daily_clean_preserve_days \
daily/140.clean-rwho:		rc=$(find . ! -name . -mtime +$daily_clean_rwho_days \
daily/405.status-ata-raid:	for raid in `find /dev/ -name 'ar[0-9]*' -type c | egrep '[0-9]$' \
daily/470.status-named:	find /var/log -name 'messages.*' -mtime -2 |
security/100.chksetuid:	find -sx $MP /dev/null -type f \
security/800.loginfail:	find ${LOG} -name 'auth.log.*' -mtime -2 |
security/900.tcpwrap:	find ${LOG} -name 'messages.*' -mtime -2 |
weekly/320.whatis:		echo "manpath failed to find any manpage directories"
weekly/330.catman:		    echo "manpath failed to find any manpath directories" 
weekly/340.noid:	rc=$(find -H ${weekly_noid_dirs:-/} \
```

take a closer look at the source to find out why


----------



## avilla@ (Mar 2, 2010)

it's probably the daily security script. mine starts at 3:01 am


----------



## fronclynne (Mar 3, 2010)

killasmurf86 said:
			
		

> find is used in many daily scripts
> 
> ```
> # cd /etc/periodic
> ...



/etc/periodic/weekly/310.locate executes locate.updatedb(8), which is a sh(1) script that ends up calling find(1).  It can run pretty long, too.  It's the one I usually notice, if I'm awake when it runs.

(they have such clever ways of hiding their finds, but we will find them, yes we will)


----------



## mdg583 (Mar 3, 2010)

Thanks all.


----------



## chrcol (Mar 12, 2010)

some here may remember the server I posted about that had a directory with many files in that I couldnt delete.

that server used to run find forever and if left alone unattended after some days multiple find's would be running and the server hanging until they killed.  so at least I now know what was running find.


----------

