Date: Sat, 04 Nov 2000 20:58:00 -0600 (CST) From: Don Read <dread@texas.net> To: cjclark@alum.mit.edu Cc: Steve Price <sprice@hiwaay.net>, freebsd-questions@FreeBSD.ORG Subject: Re: 'crontab -e' woes Message-ID: <XFMail.001104205800.dread@texas.net> In-Reply-To: <20001104125046.R75251@149.211.6.64.reflexcom.com>
index | next in thread | previous in thread | raw e-mail
On 04-Nov-00 Crist J . Clark wrote:
<snip>
> .... If you had the second command like,
>
> $ crontab -l | tail +4 | sed '1s/^/#/' | crontab -
>
always thinking in term of tail -n, +n never occured to me.
> It would do what the original poster wanted. But I do not see why he
> cannot get the vi(1) to work. And I really cannot ficure out why
> sometimes it works and sometimes it does not work for me.
'nother datapoint:
$ echo $EDITOR
ed
localhost.dread$ crontab -e
44
1s/^/#/
wq
45
crontab: installing new crontab
localhost.dread$ crontab crontab.keep
localhost.dread$ (echo '1s/^/#/'; echo 'wq') | crontab -e
44
45
crontab: no changes made to crontab
Weird :-/ let's grub around in the crontab.c
if (mtime == statbuf.st_mtime) {
warnx("no changes made to crontab");
goto remove;
}
Ah-hah : it checks st_mtime (a granularity of one second).
So you have crontab writing the tempfile, exec's ed, and if ed finishes within
the second, crontab thinks nothing changed.
(o'boy, my first pr)
BTW: This might be poorly remembered trivia from my SysV days, but ...
vi will give-up (& exit) if curses complains about
A) a non-tty.
B) a terminfo(cap) that can't move the cursor non-destructively.
If that holds for FreeBSD, until crontab is a bit more critcal about
changed files; then i think you're left with
crontab -l | tail +4| {sed, awk} | crontab -
Regards,
--
Don Read dread@texas.net
There are old sailors, and there are foolish
sailors; but damn few old foolish sailors.
---------------------------------------------
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.001104205800.dread>
