Oops... I meant for this to go to the list... Sorry 'bout that Lynn :(
On Wed, Jun 19, 2002 at 09:43:32PM -0500, guitarlynn wrote:
>
> If you "touch (filename)" like Charles had suggested, it updates the
> time stamp w/o modifying anything else in the file. This is commonly
> used when compiling libraries or db's as well.
>
> I hope this helps,
Well, not actually :(
Getting the file in there is no problem. Getting cron to notice
something happened is.
Please CMIIW, but from what I understand, the way cron gets aware of
changes in the userland crontabs, is that it sees that the timestamp on
the *directory* has changed. Cron then checks whatever tabs are in the
dir, and reloads itself with the new stuff. So far so good.
'Touch' does little to help with the above, because:
# touch crontabs
touch: crontabs: Is a directory
- but in any case, the user can't touch anything that's owned by root,
unless it's world-writable, which it is not...
My 'problem' is that operations*) on the file *in* the dir doesn't update
the stamp on the dir itself, unless whoever (sh-httpd:adm in this case)
has some kind of write-privs *on* the dir. So in lieu of a 'crontab'
command that would do it (update the file *and* the timestamp on the
dir) I changed the perms...
Jeff's post, however, has made me realize that maybe this is not such a
great way of getting said timestamp updated after all. And that Eric's
suggestion of having a small C-executable (suid) perform the actual
operation instead, is probably better. I'm thinking that having the
paths/filenames hardcoded into the C-executable might be a way of
minimizing the potential abuse of such a program(?)
Alternatively, I guess if the C-exec just did something like:
- create an empty file in .../crontabs/
- remove it again immediately
I would effectively get cron's attention, which is what this is all
about. The advantage to this approach should be that there is little
risk in having an suid C-proggie that does nothing but create/remove an
empty file in a hardcoded location... right?
*) What I do is this:
Rather than edit the file in-place, I generate a new one in a temporary
location, remove the old file, and copy the new one to the crontabs/
dir.
The reasons I do it like this are several.
First of all it was a much simpler way to go, with little risk of
damaging the original crontab.
Secondly, some of the values involved don't have any defined place in
the crontab. So I keep a separate table, where everything is stored.
Thirdly, if the programs are set (via the webinterface) to *not* run on
specified day(s), it's *much* simpler if the script which builds the
new crontab just skips writing those entries, instead of writing them,
but #'ing them out.
Fourth, a table with a given delimiter (':' f.x.) is *way* easier to
both parse, *and* update.
This may be 'baby' programming, but it works. :)
Guess I'm going to have to learn a little C next ;D
cheers,
Jon Clausen
----- End forwarded message -----
-------------------------------------------------------
Bringing you mounds of caffeinated joy
>>> http://thinkgeek.com/sf <<<
------------------------------------------------------------------------
leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html