[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: restart cron in Solaris
From: |
Ted Zlatanov |
Subject: |
Re: restart cron in Solaris |
Date: |
Mon, 10 Dec 2001 12:37:22 -0500 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i386-redhat-linux-gnu) |
Darren Dunham <ddunham@taos.com> writes:
>> Is this safe? Seems dangerous to edit /var/spool/cron/crontabs/root
>> directly, cron is placing the real file here, what if cron overwrites the
>> edits?
>
> 'cron' doesn't move/write crontab files, 'crontab' does.
>
> Yes, there's a race condition here, but you should decide how bad it
> could be. I would imagine that it's pretty safe. If you're talking
> about root's crontab, then if you know that it's maintained by cfengine,
> you shouldn't be editing it anyway.
1) I don't have the source to crontab for Solaris, but fcron's
fcrontab.c seems to handle this correctly, first reading the entire
file into memory and then writing it out to disk, whether the file
is from disk or from STDIN. Interestingly, the fcrontab.c copy()
function would overwrite the original crontab if it were used, but
it's not used to install the crontab as far as I can see. I think
the file is always prebuffered because otherwise you'd have to make
two functions, one for STDIN and one for regular files.
2) I've been using this method (invoking crontab on the cron tab file
itself) for a while now on Linux and Solaris without any problems.
I suppose it could be hacked with a precopy:
"/bin/cp $(root_crontab) /tmp/XYZ; $(crontab) /tmp/XYZ"
or by copying the crontab from /etc/cfengine/crontabs and editing
that file, but the direct-from-cron-spool method is more elegant
and pretty safe in my experience.
3) I'd only use this method where cfengine was the sole maintainer of
the file, of course...
Ted
- encrypt.c: In function `LoadSecretKeys':, Rune Mossige, 2001/12/05
- Re: encrypt.c: In function `LoadSecretKeys':, Rune Mossige, 2001/12/06
- Re: encrypt.c: In function `LoadSecretKeys':, Eric Methorst, 2001/12/07
- restart cron in Solaris, Daniel Nilsson, 2001/12/07
- Re: restart cron in Solaris, Ted Zlatanov, 2001/12/07
- Re: restart cron in Solaris, Alan Silver, 2001/12/07
- Re: restart cron in Solaris, Katherine Morris, 2001/12/07
- Re: restart cron in Solaris, Daniel Nilsson, 2001/12/10
- Re: restart cron in Solaris, Darren Dunham, 2001/12/10
- Re: restart cron in Solaris,
Ted Zlatanov <=
- Re: restart cron in Solaris, Dan Zubairi, 2001/12/10
- Re: restart cron in Solaris, Katherine Morris, 2001/12/10
- Re: restart cron in Solaris, Katherine Morris, 2001/12/10
- Re: restart cron in Solaris, Daniel Nilsson, 2001/12/11
- Re: restart cron in Solaris, Katherine Morris, 2001/12/12
- Re: restart cron in Solaris, Rich Dempsey, 2001/12/12
- Re: restart cron in Solaris, Darren Dunham, 2001/12/12
- Re: restart cron in Solaris, Rich Dempsey, 2001/12/12
- Re: restart cron in Solaris, Marion Hakanson, 2001/12/13
- Re: restart cron in Solaris, Ted Zlatanov, 2001/12/14