Mailinglist Archive: opensuse (3337 mails)

< Previous Next >
Re: [SLE] cron not recognizing changes to /etc/cron.d files [SOLVED]
  • From: Joachim Schrod <jschrod@xxxxxxx>
  • Date: Mon, 10 Apr 2006 17:01:32 +0200
  • Message-id: <443A734C.7040402@xxxxxxx>
Leendert Meyer wrote:

the file status change date, aka st_ctime in <sys/stat.h>. In fact, I don't

I do not have a <sys/stat.h> in /usr/include/, but a <bits/stat.h>, but st_ctime is mentioned there too.

You're right that the actual definition of st_ctime is in bits/stat.h.
But sys/stat.h is the canonical include file that is used to get at that definition, as per the POSIX standard. And I'm quite sure that if you have a bits/stat.h, you have a sys/stat.h as well, as both are in the same rpm package, namely glibc-devel.

From that I conclude that st_ctime is also named the "file's creation time". Correct?

No. st_ctime is the file status change timestamp. It is updated on any change to the file or the file's name or other timestamps.

In the original context of this thread, where it was mentioned for the timestamp flag file /var/spool/cron/lastrun/cron.daily, st_ctime is the creation time, but this is not the general semantics.

know of any C function that could set it. If you know one, speak up and
tell us.

No. But in a shell one posibility could be 'cat f.txt > tmp.txt; cat tmp.txt > f.txt; rm tmp.txt'. But a shell is not C.

Updating it to the current time can be done with touch. What we are looking for is an easy method to set it to some arbitrary timestamp, in the past or in the future. The ctime of the file cited above is the time when the jobs in /etc/cron.daily are run. Some people, who don't turn their systems off, want these jobs to be run in the night. For that, they need to change the ctime of that file, let's say to 04:45 or something like that. touch won't work here. The only known way to do that is by typing:

$ at 04:43
> rm /var/spool/cron/lastrun/cron.daily
> <EOF>

(where <EOF> is typically Ctrl-D). Then that file will be (re-)created by the cron job that starts at 04:45. We are looking for a method that does the above more easily and can be explained more easily to newbies.


Joachim Schrod Email: jschrod@xxxxxxx
Roedermark, Germany

< Previous Next >
Follow Ups