LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-28-2011, 12:37 AM   #1
password636
Member
 
Registered: Jun 2006
Location: Beijing
Posts: 60

Rep: Reputation: 1
tmpwatchc updates directory ctime?


Hi,

I noticed that some directories under /tmp were updated ctime daily. As you can see below, I thought that was because of tmpwatch.
Code:
[root@localhost ~]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
[root@localhost ~]# ls /etc/cron.daily/
0anacron  0logwatch  cups  logrotate  makewhatis.cron  mlocate.cron  prelink  rpm  tmpwatch
[root@localhost ~]# ls -lc /tmp
total 44
drwx------ 3 root root 4096 Nov 10 11:15 gconfd-root
drwx------ 2 root root 4096 Nov 10 11:15 keyring-qFRB6k
srwxr-xr-x 1 root root    0 Nov 10 11:16 mapping-root
drwx------ 2 root root 4096 Nov 10 11:16 orbit-root
drwx------ 2 root root 4096 Nov 10 11:15 ssh-rAIQTP2769
drwx------ 2 root root 4096 Nov 10 11:16 virtual-root.X9XGxG
[root@localhost ~]# date
Thu Nov 10 11:17:14 CST 2011
[root@localhost ~]# /etc/cron.daily/tmpwatch
[root@localhost ~]# ls -lc /tmp
total 44
drwx------ 3 root root 4096 Nov 10 11:17 gconfd-root
drwx------ 2 root root 4096 Nov 10 11:17 keyring-qFRB6k
srwxr-xr-x 1 root root    0 Nov 10 11:16 mapping-root
drwx------ 2 root root 4096 Nov 10 11:17 orbit-root
drwx------ 2 root root 4096 Nov 10 11:17 ssh-rAIQTP2769
drwx------ 2 root root 4096 Nov 10 11:17 virtual-root.X9XGxG
[root@localhost ~]#
But how come tmpwatch updates directory ctime? Even if there is no file deleted under that directory:
Code:
[root@localhost ~]# ls -lc
total 92
drwxr-xr-x 2 root root  4096 Nov 28 13:26 Desktop
-rw------- 1 root root  1414 Feb  3  2010 anaconda-ks.cfg
-rw-r--r-- 1 root root 51009 Feb  3  2010 install.log
-rw-r--r-- 1 root root  3696 Feb  3  2010 install.log.syslog
drwxr-xr-x 2 root root  4096 Nov 28 13:33 test
[root@localhost ~]# ls test
file
[root@localhost ~]# ls test/file  -lc
-rw-r--r-- 1 root root 0 Nov 28 13:30 test/file
[root@localhost ~]# date
Mon Nov 28 14:00:17 CST 2011
[root@localhost ~]# /usr/sbin/tmpwatch -umc 1 /root/test
[root@localhost ~]# ls -lc
total 92
drwxr-xr-x 2 root root  4096 Nov 28 13:26 Desktop
-rw------- 1 root root  1414 Feb  3  2010 anaconda-ks.cfg
-rw-r--r-- 1 root root 51009 Feb  3  2010 install.log
-rw-r--r-- 1 root root  3696 Feb  3  2010 install.log.syslog
drwxr-xr-x 2 root root  4096 Nov 28 14:00 test
[root@localhost ~]# ls test/file  -lc
-rw-r--r-- 1 root root 0 Nov 28 13:30 test/file
[root@localhost ~]#
The file "/root/test/file" does not change, but "/root/test" gets updated ctime. Why?

THANKS
 
Old 11-29-2011, 10:44 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
A quick look at the strace output from tmpwatch shows that it performs a utime() system call to reset the directory's access and modification times back to their original values. That has the effect (unfortunate, in this case) of updating the ctime.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rename and ctime whossa Linux - Software 6 11-17-2011 01:52 AM
How to use ctime(time.h) tnjones Programming 3 09-22-2008 08:29 PM
ctime of /etc/samba/smbpasswd different ddaas Linux - Security 0 07-04-2005 01:42 AM
Which directory do the Updates go to? duffmckagan Mandriva 8 06-08-2005 08:35 PM
mtime/ctime changed on directory entries stardot Linux - Security 2 11-29-2004 10:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration