Nginx – /usr/sbin/tmpwatch -am 1 /tmp/nginx_client not cleaning nginx temporary files

nginxtmpwatch

I installed nginxcp (A nginx plugin for cpanel).

They recommend to add the following cron job to clean the temp files.

0 */1 * * * /usr/sbin/tmpwatch -am 1 /tmp/nginx_client

But it does't work.
Even running the command /usr/sbin/tmpwatch -am 1 /tmp/nginx_client nothing happens. None of the files are being removed.

The only strange thing I noticed, is that all tmp files that are being stored at /tmp/nginx_client belongs to nobody nobody.

What am I doing wrong?

thanks.

Best Answer

As shown in your question and comments, you've configured tmpwatch to remove all files (-a) that have a modification time (-m) that is older than one hour (1) from the /tmp/nginx_client directory.

As indicated in your comments, a --verbose option indicates that some of those files are being deleted.

Therefore, tmpwatch is behaving correctly and you must look elsewhere in your application to trim the temporary files that are constantly being updated by your application.

If you're still running out of /tmp space, you need to look elsewhere for a solution. This may take the form of fixing poorly thought-out code or in the case of log files using logrotate to truncate the logs.