View Full Version : [all variants] Strange Cron Command

May 19th, 2008, 07:52 PM
Can anyone tell me what this might do?

[ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -r -0 rm

It's in my cron commands and set to execute as root.

May 19th, 2008, 10:02 PM
Basically, if /var/lib/php5 exsits, and any files in that directory were created recently, it runs the files. I'm not sure what purpose it has. That cron script seems to be installed by the php5-common package.

May 19th, 2008, 10:15 PM
Hrm. Does that really need to run as root? I guess it might if it's the PHP binaries.

May 19th, 2008, 10:20 PM
Sorry, it doesn't run the file if it's new, it deletes the file if it's old. Garbage collection, cleaning old sessions.


man test
man find
man xargs

May 20th, 2008, 12:55 AM
Thank you.