[Top][All Lists]

[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 21:33:30 -0500

Since you're running as root anyway, it's sufficient to say 

        su <user> -c "crontab filename"

No need to stick the command in a script outside of cfengine.
And since the master copy, i.e., the one maintained by cfengine,
is no longer the one in /var/spool/cron/crontabs, there's
no need to create the temporary file.

I wholeheartedly agree with you about avoiding unpublished


At 06:18 PM 12/12/2001 -0800, Darren Dunham wrote:
>> 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                                           address@hidden
>Unix System Administrator                    Taos - The SysAdmin Company
>Got some Dr Pepper?                           San Francisco, CA bay area
>          < How are you gentlemen!! Take off every '.SIG'!! >
>Help-cfengine mailing list


Richard C. Dempsey              email: address@hidden                       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]