On Fri, Jan 14, 2011 at 4:32 PM, Forrest Aldrich <for...@gmail.com> wrote:

> Running crontab -e is not applicable to what I'm doing here.  I experimented 
> with it and it turns out you can't use that functionality in a scripted 
> environment, it doesn't work.    I have a script that edits a line of a 
> crontab, either commented out or not.  Then it needs to tell cron to re-read 
> the tabs.

How about:

tmpfile=`mktemp`
crontab -l > $tmpfile
...  # munge the file here or in a pipeline with the previous command
crontab $tmpfile
rm -f $tmpfile

Before I knew about that approach, I also did things like setting
EDITOR (be sure VISUAL is unset) to the name of a script that knows
how to munge it.  That is, something like the following:

env -i PATH=$PATH EDITOR=/my/script crontab -e

And if you already edited it in place (I advise against it...)

env -i PATH=$PATH EDITOR=touch crontab -e

-- 
Mike Gerdts
http://mgerdts.blogspot.com/
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to