From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 86D6C13838B for ; Fri, 19 Sep 2014 07:47:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C3202E088C; Fri, 19 Sep 2014 07:47:43 +0000 (UTC) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A9A20E0874 for ; Fri, 19 Sep 2014 07:47:42 +0000 (UTC) Received: by mail-we0-f182.google.com with SMTP id q59so1593554wes.41 for ; Fri, 19 Sep 2014 00:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=4BDoSkazi6z1VIdC76FU+a361e3mRTYfPOgBCNePF6E=; b=vDRpXlO1WOHlmS9nTlJx6oUfwP86ciBf2EwxYS1ajKLOXo3TO8TmWIhYmKQ2APpuWU OLuR6XBUk86nhguPTFe1ZmixjCy4cXxY/WYpj2F2ExS/HF5ZxI0jd2aQ4n8ebh1Ypv80 qkYzQ/uW++RRPF/iPs024BZ8ZgoU2V7ZcuwOeMIYeBmZqeJf44uLyBv9pVWLHWWVmL5n H+0aXOclA+uOcftS6jbsDhp5kORQMnFeVFIM77rX01pPAlwge652+aJtFbbwydA3Y/kd TOc+ngQeIe3hC1rQbn1tYIoqhqf0v7pFpXwmCQXr2QRgzksxFmrSle811EcuCzzhhwuN NIvg== X-Received: by 10.180.76.209 with SMTP id m17mr4440774wiw.78.1411112861209; Fri, 19 Sep 2014 00:47:41 -0700 (PDT) Received: from [192.168.178.22] (adsl-62-167-25-217.adslplus.ch. [62.167.25.217]) by mx.google.com with ESMTPSA id pm2sm1166118wic.13.2014.09.19.00.47.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Sep 2014 00:47:40 -0700 (PDT) Message-ID: <541BDF9B.7080204@gmail.com> Date: Fri, 19 Sep 2014 09:47:39 +0200 From: =?windows-1252?Q?Stephan_M=FCller?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] crontab - "and' condition References: <20140918164457.GB32767@syscon7> In-Reply-To: <20140918164457.GB32767@syscon7> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Archives-Salt: 746d76ba-2cf0-459b-9077-3e1a9c5f19fd X-Archives-Hash: 85c80cf9beae779b40cbf888cdb4bf62 Am 18.09.2014 um 18:44 schrieb Joseph: > I want to run a cron job only once a month. The problem is the computer is only on on weekdays Mon-Fri. 1-5 > cron tab as this below is an "or" condition as it has entries in Days of the Months and Day of the Week > > 5 18 1 * 2 rsync -av ... > > so it will run on days 1 or Tuesday of each months. > Is it possible to create "and" condition, eg. run it on Tuesday between days 1 to 7; depend on which day Tuesday falls on? You can run it every Tuesday and check for day of month externally: 5 18 * * 2 test $(date +%d) -le 7 && rsync -av ... or run it on 5 18 1-7 * * and test for Tuesdays, but the former gives less useless invocations. ~frukto