From owner-freebsd-questions Thu Nov 2 22: 7:31 2000 Delivered-To: freebsd-questions@freebsd.org Received: from pc759.cs.msu.su (pc759.cs.msu.su [158.250.10.223]) by hub.freebsd.org (Postfix) with ESMTP id 96C6437B4E5 for ; Thu, 2 Nov 2000 22:07:27 -0800 (PST) Received: from pc759.cs.msu.su (uucp@localhost) by pc759.cs.msu.su (8.9.3/8.9.3) with UUCP id WAA65661; Thu, 2 Nov 2000 22:13:41 +0300 (MSK) (envelope-from ark@pc759.cs.msu.su) Received: from pc759.cs.msu.su (megagame.my.home [10.0.1.5]) by gateway.my.home (8.8.8/8.8.8) with ESMTP id UAA03210; Thu, 2 Nov 2000 20:03:17 +0300 (MSK) (envelope-from ark@pc759.cs.msu.su) Message-ID: <3A01C9C9.4BEB1865@pc759.cs.msu.su> Date: Thu, 02 Nov 2000 20:08:41 +0000 From: ark X-Mailer: Mozilla 4.72 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 To: alum.mit.edu!cjclark@pc759.cs.msu.su Cc: Steve Price , FreeBSD.ORG!freebsd-questions@pc759.cs.msu.su Subject: Re: 'crontab -e' woes References: <20001101210426.A57642@bsd.planetwe.com> <20001101234720.J75251@149.211.6.64.reflexcom.com> Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG  

"Crist J . Clark" wrote:

On Wed, Nov 01, 2000 at 09:04:26PM -0600, Steve Price wrote:
> Howdy all,
>
> Don't know if it is just a couple of days of absolutely no
> sleep or what but I've been scratching my over head what
> should be a simple problem.
>
> Basically what I'm trying to do is setup a non-interactive
> script that edits my crontab.  When I type the following
> commands in it comments out the first entry.  However, when
> I run it by redirecting stdin from a file it doesn't work.
> >From the looks of it (note the 37 -> 38 change) the file
> is being updated but crontab is ignoring the change.
>
May be, you choose wrong method to do; if you need from time to time do something with
1 second intervals you'll be better run script with 'sleep 1' command in it and internal counter.
 
> steve@bsd(/tmp)$ crontab -l
> # DO NOT EDIT THIS FILE - edit the master and reinstall.
> # (/tmp/crontab.teFMi62568 installed on Wed Nov  1 20:47:27 2000)
> # (Cron version -- $FreeBSD: src/usr.sbin/cron/crontab/crontab.c,v 1.12 1999/08/28 01:15:52 peter Exp $)
> */1     *       *       *       *       /home/steve/bin/bogus.sh
> steve@bsd(/tmp)$ cat cmds
> 1s/^/#/
> wq
> steve@bsd(/tmp)$ env VISUAL=/bin/ed crontab -e < cmds
> 37
> 38
> crontab: no changes made to crontab
> steve@bsd(/tmp)$ cat cmds | env VISUAL=/bin/ed crontab -e
> 37
> 38
> crontab: no changes made to crontab
> steve@bsd(/tmp)$
>
> Can anyone tell what I'm doing wrong?  Thanks.

Don't ask me why, but try this,

  $ { echo '1s/^/#/'; echo w; } | env VISUAL=/bin/ed crontab -e

And see what happens. (Just lost the 'q.')
--
Crist J. Clark                           cjclark@alum.mit.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message

To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message