Comment 50 for bug 876387

Ondřej Surý (ondrej) wrote :

Ben,

could you try replacing the standard cron-job with this script:

-- cut here --
#!/bin/sh

# first find all used files and touch them (hope it's not massive
amount of files)
lsof -w -l +d /var/lib/php5 | awk -e '{ if (NR > 1) { print $9; } }'
| xargs -i touch -c {}

# find all files older then maxlifetime
find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f
-ignore_readdir_race -cmin +$(/usr/lib/php5/maxlifetime) -delete
-- cut here --

It takes other approach which should be lighter to the system, but I need a confirmation from users before I apply it to Debian package (and before it gets pulled to Ubuntu).

Ondřej