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 43D7D13838B for ; Fri, 19 Sep 2014 07:11:10 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DFB9AE08BF; Fri, 19 Sep 2014 07:11:04 +0000 (UTC) Received: from mail-we0-f170.google.com (mail-we0-f170.google.com [74.125.82.170]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C7DD5E089A for ; Fri, 19 Sep 2014 07:11:03 +0000 (UTC) Received: by mail-we0-f170.google.com with SMTP id u57so2020338wes.15 for ; Fri, 19 Sep 2014 00:11:02 -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=KeNJ7sxIN1AWtIjAEIPZwqC2mMIAvdLOMLiT/T9swyU=; b=TC+W8ZbilidA315MXoaNqIBx72FWc0FDeS0YpvcVjZYRgakwo1vSI3r+6F52JoomRK ip67Oq/zRaSiQP6rwsz1SScZ5gweEDdrRm0PUn884auMEScnTyx/591efpfu/pO73QPG dZ9f3py0pbqf+y6W0ekxVPc8dDyjpr0hYDXi+I0pQcz+sDW1jwYhwM95amE8Fc2w0Doe XDmPTRSxF55YhT9KV2ZbS4hAQ9n7yGbOMEnE5EGGJ21B/QOjbZ5rAGp7yp3NHCa7WokE lkbi0h0U00RYWEkGhrHQo2leT15KMd099OvWPjsQhgUgCO57zfdYJSqAvEL06V/e66ty pLqA== X-Received: by 10.194.23.167 with SMTP id n7mr10269592wjf.35.1411110662203; Fri, 19 Sep 2014 00:11:02 -0700 (PDT) Received: from [192.168.1.40] ([41.85.145.17]) by mx.google.com with ESMTPSA id q3sm1064905wia.14.2014.09.19.00.11.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Sep 2014 00:11:01 -0700 (PDT) Message-ID: <541BD6BA.4070408@gmail.com> Date: Fri, 19 Sep 2014 09:09:46 +0200 From: Alan McKinnon User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 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> <541B12DD.5070105@gmail.com> <20140919042158.GJ32767@syscon7> In-Reply-To: <20140919042158.GJ32767@syscon7> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Archives-Salt: 658056db-f33b-492d-9ff2-df8d57176884 X-Archives-Hash: 43dc08c828545ae65bbd360423f0c62d On 19/09/2014 06:21, Joseph wrote: > On 09/18/14 19:14, Alan McKinnon wrote: >> On 18/09/2014 18:44, Joseph wrote: >>> 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? >> >> >> Not in one line. >> >> Split it into two crontab entries. > > Interesting. How do you split cron job? I couldn't find any examples. > No wait, that won't work. What you want to accomplish cannot be done with a single crontab job. Use periodic/monthly like the other poster said or use anacron so the job will run when the machine is next powered on. -- Alan McKinnon alan.mckinnon@gmail.com