From owner-freebsd-questions Sat Nov 4 18:59: 1 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mw5.texas.net (mw5.texas.net [206.127.30.15]) by hub.freebsd.org (Postfix) with ESMTP id 88B0537B4E5 for ; Sat, 4 Nov 2000 18:58:57 -0800 (PST) Received: from localhost.texas.net (tcnet21-026.austin.texas.net [209.99.96.215]) by mw5.texas.net (2.4/2.4) with ESMTP id UAA25786; Sat, 4 Nov 2000 20:58:49 -0600 (CST) Received: (from dread@localhost) by localhost.texas.net (8.9.3/8.9.3) id UAA28332; Sat, 4 Nov 2000 20:58:46 -0600 (CST) (envelope-from dread) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20001104125046.R75251@149.211.6.64.reflexcom.com> Date: Sat, 04 Nov 2000 20:58:00 -0600 (CST) From: Don Read To: cjclark@alum.mit.edu Subject: Re: 'crontab -e' woes Cc: Steve Price , freebsd-questions@FreeBSD.ORG Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 04-Nov-00 Crist J . Clark wrote: > .... 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