help-cfengine
[Top][All Lists]
Advanced

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

Re: restart cron in Solaris


From: Darren Dunham
Subject: Re: restart cron in Solaris
Date: Wed, 12 Dec 2001 18:18:12 -0800 (PST)

> 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.

The problem(?) arises when maintaining multiple crontabs (or any crontab
other than root).

Because the 'crontab <filename>' offers no means to specify the user (as
the crontab -l does), you must run it as the user.  That usually
involves doing su's in a script and using temp files.  I like to avoid
both of those items.

1) Put crontab in tempfile.
2) su $user "crontab tempfile"
3) rm tempfile

An alternative is to use the same mechanism that crontab uses.
1) Put the crontab in place.
2) Send a particular piece of data to the cron FIFO.

This is annoying because you're using an unpublished interface, so it's
quite non-portable and could break in the future, but I hate doing su's
in scripts when I can avoid them.  The actual message isn't very
difficult to send, and I do it in a perl script (outside of cfengine).

Another alternative is more brute-force.
1) Put the crontab(s) in place.
2) Kill and restart cron.


-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
          < How are you gentlemen!! Take off every '.SIG'!! >



reply via email to

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