From owner-freebsd-questions@FreeBSD.ORG Thu Aug 26 20:13:12 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E47D916A4CE for ; Thu, 26 Aug 2004 20:13:11 +0000 (GMT) Received: from smtp812.mail.sc5.yahoo.com (smtp812.mail.sc5.yahoo.com [66.163.170.82]) by mx1.FreeBSD.org (Postfix) with SMTP id ABC5C43D39 for ; Thu, 26 Aug 2004 20:13:11 +0000 (GMT) (envelope-from krinklyfig@spymac.com) Received: from unknown (HELO smogmonster.com) (jtinnin@pacbell.net@64.171.1.210 with login) by smtp812.mail.sc5.yahoo.com with SMTP; 26 Aug 2004 20:13:11 -0000 From: Joshua Tinnin To: freebsd-questions@freebsd.org Date: Thu, 26 Aug 2004 13:13:16 -0700 User-Agent: KMail/1.6.2 References: <200408260007.26659.krinklyfig@spymac.com> <200408260109.12229.krinklyfig@spymac.com> <412E0193.6080904@daleco.biz> In-Reply-To: <412E0193.6080904@daleco.biz> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200408261313.16037.krinklyfig@spymac.com> Subject: Re: crontab question involving cvsup X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: krinklyfig@spymac.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Aug 2004 20:13:12 -0000 On Thursday 26 August 2004 08:28 am, "Kevin D. Kinsey, DaleCo, S.P." wrote: > Joshua Tinnin wrote: > >On Thursday 26 August 2004 12:42 am, epilogue > > > > > >wrote: > >>On Thu, 26 Aug 2004 00:07:26 -0700 > >> > >>Joshua Tinnin wrote: > >>>OK, I have searched the archives, and I can't find that my > >>> question has been answered previously, but please forgive me if > >>> that's incorrect. > >>> > >>>I'm using (or rather trying to use) cron to update my ports tree > >>>daily. I've tried several different combinations without success, > >>>and lately this is what I have in my crontab file: > >>> > >>>/usr/local/bin/cvsup -g -L 2 > >>>/home/krinklyfig/supfiles/ports-supfile && > >>> /usr/local/bin/portindex && /usr/local/sbin/portsdb -u > >>> > >>>It runs as root once a day. What appears to be happening is that > >>>the cvsup is happening, but portindex is not, and because of the > >>>latter portsdb -u doesn't either. The reason I know cvsup is > >>>working is because portindex indicates that the ports tree has > >>> been updated if I run it manually later, but running portversion > >>> before manually running portindex will not indicate any changes. > >>> The cron log doesn't show anything but the commands being > >>> executed. So, my question is: is this type of command valid, or > >>> should each command be separate? Or is it not working for some > >>> other reason? > >> > >>man cron gives: > >> > >>crontab [-u user] file > >> > >>'file' being the important part, methinks. ;) > > > >I'm not sure what you mean ... If you're wondering, I'm using the > > main crontab file (/etc/crontab), as right now there's no need for > > me to use multiple ones. > > Just an aside, but a rather important one: /etc/crontab is the > *system* crontab and shouldn't have your jobs in it. It may in fact > be this issue that is causing the problem, but I've not looked into > it enough to say unequivocally... I don't think this is true. For one thing, as suggested, directing output of cvsup to /dev/null worked, and now my cron job is working. Another is that neither the handbook nor the /etc/crontab file itself warn about editing it. In fact, the handbook section 11.6 says, "Important: You must not use the procedure described here to edit/install the system crontab. Simply use your favorite editor: the cron utility will notice that the file has changed and immediately begin using the updated version." This is what I did. I didn't use the crontab command to edit/install it, I just used an editor. > Since your job needs root privileges, you should put this in root's > crontab, either by su'ing to root and running "crontab -e" at the > prompt, or if you have sudo installed, "sudo crontab -e" will get you > there. > > Unlike the system crontab, user crontabs, including root's, are > under /var/cron; the file format is slightly different, and misuse > of the system crontab for regular jobs is the cause of several > FAQ posts we see here every few months or so; one of these goes > something like, "why do I get an email from cron saying it can't > complete my job, unknown user, etc. ??".... Again, I see nothing in the documentation warning against editing the system crontab file, only that it can't be installed/edited with the crontab command. - jt