From owner-freebsd-questions@FreeBSD.ORG Mon Jun 8 14:36:16 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14EA510656A5 for ; Mon, 8 Jun 2009 14:36:16 +0000 (UTC) (envelope-from paul+fbsd@it.ca) Received: from mail.it.ca (mail.it.ca [216.235.7.67]) by mx1.freebsd.org (Postfix) with ESMTP id C8B708FC1E for ; Mon, 8 Jun 2009 14:36:12 +0000 (UTC) (envelope-from paul+fbsd@it.ca) Received: from mail.it.ca (paul@mail [216.235.7.67]) by mail.it.ca (8.13.3/8.13.3) with ESMTP id n58EaAZJ010344; Mon, 8 Jun 2009 10:36:11 -0400 (EDT) (envelope-from paul+fbsd@it.ca) DomainKey-Signature: a=rsa-sha1; s=a; d=it.ca; c=nofws; q=dns; h=received:x-authentication-warning:date:from:to:cc:subject: message-id:reply-to:references:mime-version:content-type: content-disposition:in-reply-to:user-agent; b=xcQCf0vHOBda+56KmqhCdbE7pApArvIAT+r7vOQjcFnXTu4GXGRaxDJscQcddeBsO xRib+YfQVSdGaH81VNmTKwVZVhR+6JMlyXaAslnYkXovymauvg9Zf9nX5HVqfMq Received: (from paul@localhost) by mail.it.ca (8.13.3/8.13.3/Submit) id n58EaAxw010342; Mon, 8 Jun 2009 10:36:10 -0400 (EDT) (envelope-from paul+fbsd@it.ca) X-Authentication-Warning: mail.it.ca: paul set sender to paul+fbsd@it.ca using -f Date: Mon, 8 Jun 2009 10:36:09 -0400 From: Paul Chvostek To: Jos Chrispijn Message-ID: <20090608143609.GA5108@it.ca> References: <4A2D0A5C.8010809@webrz.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A2D0A5C.8010809@webrz.net> User-Agent: Mutt/1.5.12-2006-07-14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (mail.it.ca [216.235.7.67]); Mon, 08 Jun 2009 10:36:11 -0400 (EDT) Cc: FreeBSD Questions Subject: Re: Cronjob X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jun 2009 14:36:16 -0000 Hi Jos, On Mon, Jun 08, 2009 at 02:55:56PM +0200, Jos Chrispijn wrote: > > I would like to execute a script on every last day of the month in my > crontab. > Can someone tell me how I should solve that as it doesn't know which > month day is the last day of the month? > Solving this in the script to be executed is no option. The only solutions I see are the three-cronjob approach: 0 1 31 1,3,5,7,8,10,12 * /path/to/script 0 1 28 2 * /path/to/script 0 1 30 4,6,9,11 * /path/to/script Alternately, you could do this with a single cronjob by putting a little scripting intelligence into the crontab itself: 0 1 28-31 * * test `date -v+1d '+%d'` -eq 1 && /path/to/script That may be your easiest option. The script only gets run on the correct dates, but the cron job still gets run more frequently. p -- Paul Chvostek it.canada http://www.it.ca/