tmpwatch 라는 명령
일정 시간동안 접근이 없는 파일 삭제하기
yum -y install tmpwatch
[root@howtounix hack]# ll
total 16
-rwxr-xr-x 1 root root 8486 Aug 24 17:36 a.out
-rw-r--r-- 1 root root 1044 Aug 24 15:42 test.c
24시간 이후로 접근이 없는 파일들 삭제
[root@howtounix hack]# tmpwatch --atime 24 ./
[root@howtounix hack]# ll
total 0
간단하네.
-u, --atime
Make the decision about deleting a file based on the file’s atime (access time). This is
the default.
Note that the periodic updatedb file system scans keep the atime of directories recent.
-m, --mtime
Make the decision about deleting a file based on the file’s mtime (modification time)
instead of the atime.
-c, --ctime
Make the decision about deleting a file based on the file’s ctime (inode change time)
instead of the atime; for directories, make the decision based on the mtime.
-M, --dirmtime
Make the decision about deleting a directory based on the directory’s mtime (modifica-
tion time) instead of the atime; completely ignore atime for directories.
[출처] https://opentutorials.org/module/981/8083
'Works > CentOS & RockyLinux' 카테고리의 다른 글
CentOS 다운로드 미러 사이트 (0) | 2017.01.03 |
---|---|
CentOS7 hostname 설정 (0) | 2016.10.31 |
du 명령어의 활용 (0) | 2016.09.02 |
필요한 rpm 패키지를 다운받자 (0) | 2016.08.03 |
xferlog 항목별 분석 (0) | 2016.07.27 |