help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: restart cron in Solaris


From: Rich Dempsey
Subject: Re: restart cron in Solaris
Date: Wed, 12 Dec 2001 20:02:42 -0500

What "crontab <filename>" means is to read <filename> and stuff it into
your crontab.

The crux of the issue here is how cron knows that a crontab has been
updated.  It would be prohibitively expensive to check all the crontabs
every minute to see if any of them had changed, or worse still, to re-read
all the crontabs every minute to harvest work.  So, what cron does is
to read all the crontabs when it starts up.  The crontab command updates
your crontab in /var/spool/cron/crontabs and then tells cron to reread
that one.  Sun has chosen not to expose the notification mechanism.
They want all crontabs to go through the crontab program.

Clearly, "crontab -e" copies the current crontab to some temporary file,
and runs your favorite editor on it.  When you exit the editor, it copies
the temporary file back to the crontab directory and notifies cron.

In the context of cfengine, the mechanism for maintaining crontabs
that seems to work the most best is to maintain cfengine copies of
the crontabs in another directory of your choice and to operate on
those.  Code a class that invokes "crontab filename" whenever one
of the copies changes.  For example, you would define a class in the
editfiles: actions on changing joe's crontab.  Truth of that class
invokes crontab joe.

Rich
        

At 07:14 PM 12/12/2001 -0500, Katherine Morris wrote:
>Perhaps it uses a tmp file while you're in edit mode if you want to be
>technically specific.  But it would be totally bogus not also update the
>file in /var/spool/cron/crontabs because at some point the system will
>likely be rebooted. As you know /tmp get's wiped on reboot, and the only
>file cron reads when it starts is in /var/spool/cron/crontabs for all users.
>You'd loose all your updates if that file were never updated.
>
>The first line in my manpage for crontab says:
>
>crontab <filename>
>
>So, I think it's a well accepted practice to update cron this way...
>
>-K
>
>----- Original Message -----
>From: "Daniel Nilsson" <address@hidden>
>To: "Katherine Morris" <address@hidden>
>Cc: "Dan Zubairi" <address@hidden>; "Alan Silver" <address@hidden>;
><address@hidden>
>Sent: Tuesday, December 11, 2001 2:02 AM
>Subject: Re: restart cron in Solaris
>
>
>>
>> I always thought that crontab -e did:
>>
>> * crontab -l > /tmp/crontabhRaO1I...
>> * vi /tmp/crontabhRaO1I...
>> * crontab /tmp/crontabhRaO1I...
>>
>> At least it does that on Solaris...
>>
>> Well well, I'll go for your solution for now. :)
>>
>> Thank you all!
>>
>> /// D
>>
>> On Mon, 10 Dec 2001, Katherine Morris wrote:
>>
>> > What exactly do you think you're doing when you do crontab -e? You're
>> > overwriting that very same file, and invoking cron to re-read all at the
>> > sametime via the wonderful -e option.
>> >
>> > It's not magic folks, just use editfile to change the crontab file and
>then
>> > using a shell command to tell cron
>> > to re-read it.
>> >
>> > -Katherine
>> >
>> > ----- Original Message -----
>> > From: "Dan Zubairi" <address@hidden>
>> > To: "Daniel Nilsson" <address@hidden>
>> > Cc: "Katherine Morris" <address@hidden>; "Alan Silver"
>> > <address@hidden>; <address@hidden>
>> > Sent: Monday, December 10, 2001 7:25 PM
>> > Subject: Re: restart cron in Solaris
>> >
>> >
>> > >
>> > > No its not safe. The change will not take place unless you re-start
>cron.
>> > >
>> > > use crontab -e username
>> > >
>> > > >
>> > > > 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?
>> > > >
>> > > > Anyone else using this method?
>> > > >
>> > > > I cant find the "old" discussion in the archives... any pointers?
>> > > >
>> > > > /// Daniel
>> > > >
>> > > > On Fri, 7 Dec 2001, Katherine Morris wrote:
>> > > >
>> > > > > I'm using shell command, crontab takes a file as an argument.
>> > > > >
>> > > > > crontab /var/spool/cron/crontabs/root
>> > > > >
>> > > > > ----- Original Message -----
>> > > > > From: "Alan Silver" <address@hidden>
>> > > > > To: "Daniel Nilsson" <address@hidden>
>> > > > > Cc: <address@hidden>
>> > > > > Sent: Friday, December 07, 2001 1:17 PM
>> > > > > Subject: Re: restart cron in Solaris
>> > > > >
>> > > > >
>> > > > > > Daniel:
>> > > > > >
>> > > > > > I don't believe that cron accepts any signals. You will need to
>kill
>> > and
>> > > > > > restart the cron in order for your example to work. But, it
>might be
>> > > > > > easier to just use crontab -e rather than  editing a tmp file.
>That
>> > way,
>> > > > > > you won't have to worry about stopping and restarting cron. YOu
>> > should
>> > > > > > be able to do your example using crontab -e.
>> > > > > >
>> > > > > > alan
>> > > > > >
>> > > > > > Daniel Nilsson wrote:
>> > > > > > >
>> > > > > > > Does sending HUP to cron really reread crontabs in Solaris?
>> > > > > > >
>> > > > > > > Ive tried:
>> > > > > > >
>> > > > > > > "cron"     signal=hup inform=false
>> > > > > > >
>> > > > > > > But it doesnt work...
>> > > > > > >
>> > > > > > > How are you editing crontabs? (crontab -l > /tmp/aaa;vi
>> > /tmp/aaa;crontab
>> > > > > > > /tmp/aaa) ???
>> > > > > > >
>> > > > > > > /// Daniel
>> > > > > > >
>> > > > > > > _______________________________________________
>> > > > > > > Help-cfengine mailing list
>> > > > > > > address@hidden
>> > > > > > > http://mail.gnu.org/mailman/listinfo/help-cfengine
>> > > > > >
>> > > > > > --
>> > > > > > Alan Silver
>> > > > > > UNIX Systems Administrator
>> > > > > > Harvard Business School
>> > > > > >
>> > > > > > 617-495-5801
>> > > > > > address@hidden
>> > > > > >
>> > > > > > "The two prime movers of the Universe are Time and Luck"
>> > > > > >    -- Kurt Vonnegut
>> > > > > >
>> > > > > > _______________________________________________
>> > > > > > Help-cfengine mailing list
>> > > > > > address@hidden
>> > > > > > http://mail.gnu.org/mailman/listinfo/help-cfengine
>> > > > >
>> > > > >
>> > > >
>> > > >
>> > > > _______________________________________________
>> > > > Help-cfengine mailing list
>> > > > address@hidden
>> > > > http://mail.gnu.org/mailman/listinfo/help-cfengine
>> > > >
>> > >
>> > >
>> > > _______________________________________________
>> > > Help-cfengine mailing list
>> > > address@hidden
>> > > http://mail.gnu.org/mailman/listinfo/help-cfengine
>> >
>> >
>>
>>
>> _______________________________________________
>> Help-cfengine mailing list
>> address@hidden
>> http://mail.gnu.org/mailman/listinfo/help-cfengine
>
>
>_______________________________________________
>Help-cfengine mailing list
>address@hidden
>http://mail.gnu.org/mailman/listinfo/help-cfengine

--

Richard C. Dempsey              email: address@hidden
Kodak.com                       pager: 585-975-3539
3rd Floor, Bldg 16, KO          phone: 585-781-5232
Eastman Kodak Company
Rochester, NY 14650-0706




reply via email to

[Prev in Thread] Current Thread [Next in Thread]