From owner-freebsd-questions Sat Nov 4 0:22: 1 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mw4.texas.net (mw4.texas.net [206.127.30.14]) by hub.freebsd.org (Postfix) with ESMTP id 2524937B479 for ; Sat, 4 Nov 2000 00:21:59 -0800 (PST) Received: from localhost.texas.net (tcnet02-44.austin.texas.net [209.99.40.107]) by mw4.texas.net (2.4/2.4) with ESMTP id CAA03758; Sat, 4 Nov 2000 02:21:54 -0600 (CST) Received: (from dread@localhost) by localhost.texas.net (8.9.3/8.9.3) id CAA00403; Sat, 4 Nov 2000 02:21:53 -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: <20001101234720.J75251@149.211.6.64.reflexcom.com> Date: Sat, 04 Nov 2000 02:21:11 -0600 (CST) From: Don Read To: cjclark@alum.mit.edu Subject: Re: 'crontab -e' woes Cc: freebsd-questions@FreeBSD.ORG, Steve Price Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 02-Nov-00 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. >> >> 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 > Why all the futzing around with ex/vi/ed ? localhost.dread$ crontab -l | grep -v "^#" 46 3-23/3 * * * bin/getsignups > /dev/null localhost.dread$ crontab -l | sed 's/^46 /16 /' | crontab - localhost.dread$ crontab -l | grep -v "^#" 16 3-23/3 * * * bin/getsignups > /dev/null 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