我在 Docker 容器中运行 Ubuntu 16.04(来自 php:7.2.19-fpm),并尝试在 cron 中设置 tmpreaper 以保持 /tmp 清洁,但我只收到“跳过不同设备上的文件:...”错误
root@62fbdf27ec0f:/# touch /tmp/test.txt
root@62fbdf27ec0f:/# /usr/sbin/tmpreaper --test --verbose --showdeleted 1h /tmp
debug: Grace period is `3600' seconds.
debug: This is PID (2445) being run by UID (0), EUID (0).
debug: getcwd() is: /tmp
(PID 2445) Pretending to clean up directory `/tmp'.
debug: safe_chdir() : Before chdir(), `dirname' is inode `19302'.
debug: safe_chdir() : Before chdir(), `dirname' on device `110'.
debug: safe_chdir() : After chdir(), `dirname' is inode `19302'.
debug: safe_chdir() : After chdir(), `dirname' on device `110'.
debug: (PID 2446) Found directory entry `test.txt'.
File on different device skipped: `/tmp/test.txt'
root@62fbdf27ec0f:/# /usr/sbin/tmpreaper --verbose --showdeleted 1h /tmp
File on different device skipped: `/tmp/test.txt'
root@62fbdf27ec0f:/# ls -latr /tmp/
total 60
drwxr-xr-x 1 root root 4096 Nov 18 13:56 ..
-rw-r--r-- 1 root root 0 Nov 19 19:59 test.txt
drwxrwxrwt 1 root root 53248 Nov 19 20:00 .
root@62fbdf27ec0f:/# touch -a -t 201911191745.00 /tmp/test.txt
root@62fbdf27ec0f:/# ls -latr /tmp/
total 60
drwxr-xr-x 1 root root 4096 Nov 18 13:56 ..
-rw-r--r-- 1 root root 0 Nov 19 19:59 test.txt
drwxrwxrwt 1 root root 53248 Nov 19 20:01 .
root@62fbdf27ec0f:/# touch -c -t 201911191745.00 /tmp/test.txt
root@62fbdf27ec0f:/# ls -latr /tmp/
total 60
drwxr-xr-x 1 root root 4096 Nov 18 13:56 ..
-rw-r--r-- 1 root root 0 Nov 19 17:45 test.txt
drwxrwxrwt 1 root root 53248 Nov 19 20:01 .
root@62fbdf27ec0f:/# /usr/sbin/tmpreaper --verbose --showdeleted 1h /tmp
File on different device skipped: `/tmp/test.txt'
root@62fbdf27ec0f:/# stat /tmp/test.txt
File: '/tmp/test.txt'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 801h/2049d Inode: 2117399 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2019-11-19 17:45:00.000000000 +0000
Modify: 2019-11-19 17:45:00.000000000 +0000
Change: 2019-11-19 20:01:38.036390000 +0000
Birth: -
cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.3 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.3 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial