# What does /etc/periodic/daily/100.clean-disks do?



## littlesandra88 (Sep 26, 2013)

Hi all =)

Today I noticed that /etc/periodic/daily/100.clean-disks does a `find / ...` and deletes everything that matches:


```
sed -e 's/^[    ]*//' \
                    -e 's/[     ]*$//' \
                    -e 's/[     ][      ]*/ -o -name /g'`
```

The comment in the header says


```
# Remove garbage files more than $daily_clean_disks_days days old
```

but what is the purpose of this? And does it really scan and delete in my ZFS storage pool at /tank ?

What would happen if I remove this script?

Hugs,
Sandra =)


----------



## SirDice (Sep 26, 2013)

Look in /etc/defaults/periodic.conf:

```
daily_clean_disks_files="[#,]* .#* a.out *.core *.CKP .emacs_[0-9]*"
```
Those are the files it deletes. 



> What would happen if I remove this script?


Don't. It's disabled by default anyway.


----------



## littlesandra88 (Sep 26, 2013)

That's very interesting. I do see 
	
	



```
daily_clean_disks_enable="NO"
```
 in /etc/defaults/periodic.conf, but I still see the `find / ...` being executed from this script. So you would keep it, but modify it to exclude /tank?


----------



## SirDice (Sep 26, 2013)

What's in /etc/periodic.conf?


----------



## littlesandra88 (Sep 26, 2013)

Hopefully the default, but here I have attached it.


----------



## SirDice (Sep 26, 2013)

You posted /etc/defaults/periodic.conf, not /etc/periodic.conf. If the latter doesn't exist the settings from the default file will be used. And the default setting for daily_clean_disks_enable is NO.


----------



## littlesandra88 (Sep 26, 2013)

Ok. I don't have that one. I will add


```
touch /tmp/100find
```

to the script and see if the file exists tomorrow =)


----------



## cpm@ (Sep 26, 2013)

Besides checking /etc/defaults/periodic.conf, see periodic.conf(5)() for more details


----------



## SirDice (Sep 26, 2013)

Keep in mind that data in /tmp/ is cleared when daily_clean_tmps_enable is enabled (it's disabled by default) regardless of the setting of daily_clean_disks_enable. Also note that if you use tmpfs(5) and reboot the machine the /tmp/ directory will be empty too.


----------



## littlesandra88 (Sep 27, 2013)

Yesterday I added 
	
	



```
touch /tmp/100find
```
 to /etc/periodic/daily/100.clean-disks, and /etc/defaults/periodic.conf is unchanged from the attached last time, ie. 
	
	



```
daily_clean_disks_enable="NO"
```
 but it is still being run.


```
# ll /etc/periodic/daily/100.clean-disks /tmp/100find 
-rwxr-xr-x  1 root  wheel  1308 Sep 26 15:29 /etc/periodic/daily/100.clean-disks
-rw-r--r--  1 root  wheel     0 Sep 27 03:01 /tmp/100find
```


----------



## cpm@ (Sep 27, 2013)

Note that you mustn't change or edit /etc/defaults/periodic.conf as is quoted in the file header.


> # This is defaults/periodic.conf - a file full of useful variables that
> # you can set to change the default behaviour of periodic jobs on your
> # system.  You should not edit this file!  Put any overrides into one of the
> # $periodic_conf_files instead and you will be able to update these defaults
> # later without spamming your local configuration information.



Add the following to /etc/periodic.conf

```
# 100.clean-disks
daily_clean_disks_enable="NO"
```

Also, uses this example to apply it for your purposes (common used variables are included).


----------



## Toast (Sep 28, 2013)

These are the periodic scripts that are enabled by default and use /usr/bin/find.

daily_clean_preserve_enable
daily_clean_rwho_enable
daily_status_named_enable
daily_status_security_chksetuid_enable
daily_status_security_neggrpperm_enable
daily_status_security_loginfail_enable
daily_status_security_tcpwrap_enable


----------

