yum install tmpwatch
tmpwatch -afv 3 /tmp/
tmpwatch – removes files which haven’t been accessed for a period of time
-u. – atime deletes files based on access time, which is the default.
-m. – mtime deletes files based on the modification time.
-c. – ctime deletes files based on the creation time. For directories, it deletes files based on mtime.
-M. – dirmtime Deleting a directory is based on the modification time of the directory rather than the access time.
-a. – all Deletes all file types, not just ordinary files, symbolic links, and directories.
-d. – nodirs does not attempt to delete a directory, even if it is empty.
-d. – nosymlinks does not attempt to delete symbolic links.
-f. – force Force deletion.
-q. – quiet only reports error information.
-s. – fuser If the file is already open, try to use the "Fusing" command before deleting it. Not enabled by default.
-t. – Test is only for testing, and does not really delete files or directories.
-U. – exclude user=user does not delete whose files belong to.
-v. – verbose Print details.
-x. – exclude=path Excludes the path. If the path is a directory, all the files it contains are excluded. If the path does not exist, it must be an absolute path without symbolic links.
-10. – exclude pattern=pattern Excludes paths under a rule.