From owner-freebsd-questions@FreeBSD.ORG Tue Mar 1 19:10:53 2005 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 4018916A4CE for ; Tue, 1 Mar 2005 19:10:53 +0000 (GMT) Received: from mail28.sea5.speakeasy.net (mail28.sea5.speakeasy.net [69.17.117.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 082D443D2F for ; Tue, 1 Mar 2005 19:10:53 +0000 (GMT) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: (qmail 3759 invoked from network); 1 Mar 2005 19:10:52 -0000 Received: from dsl092-078-145.bos1.dsl.speakeasy.net (HELO be-well.ilk.org) ([66.92.78.145]) (envelope-sender ) by mail28.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 1 Mar 2005 19:10:52 -0000 Received: by be-well.ilk.org (Postfix, from userid 1147) id 41C664A; Tue, 1 Mar 2005 14:10:52 -0500 (EST) Sender: lowell@be-well.ilk.org To: "Eugene M. Minkovskii" References: <20050301072235.GA24150@mccme.ru> From: Lowell Gilbert Date: 01 Mar 2005 14:10:52 -0500 In-Reply-To: <20050301072235.GA24150@mccme.ru> Message-ID: <44zmxn41xf.fsf@be-well.ilk.org> Lines: 58 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii cc: freebsd-questions@freebsd.org Subject: Re: crontab synatx X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2005 19:10:53 -0000 "Eugene M. Minkovskii" writes: > I put in my crontab following string: > > # min hour mday month wday command > 0 7 */3 * * echo "Hello world" > > So, I hope, this command will be workind every third day: > 3,6,9,12 etc, because at man crontab we read: > > > For example, ``0-23/2'' can be used in the hours field to specify > command execution every other hour (the alternative in the V7 > standard is ``0,2,4,6,8,10,12,14,16,18,20,22''). > > > But, my command worked at 28 feb, and 1 march. The way the "/3" syntax works is that it specifies a "skip" in the values. It doesn't affect what the *first* value is, so for day of month, the first value is 1. Then it will skip 3, and will execute again on the 4th. I haven't tested this, but I think you could get what you want by saying "3-31/3" for the mday value. > Other case I type > > # min hour mday month wday command > 0 7 */14 * * echo "Hello world" > > And this is work at 15 febr. Is it bug or feature? As in the previous example, I think this behavior is exactly what the documentation describes. If you want the 14th and the 28th of every month, just put "14,28" in that field of the crontabl > Is it bug or feature? Perhaps > crontab count day of month from zero? No, it counts from one, as everyone would expect. This is required behavior according to POSIX. > If so, when should work > command if I type directly number of day: > > # min hour mday month wday command > 0 7 14 * * echo "Hello world" That will execute at 7:00 AM on the 14th of every month. > And how will be counted months? January is 1, December is 12. -- Lowell Gilbert, embedded/networking software engineer, Boston area http://be-well.ilk.org/~lowell/