From owner-freebsd-questions@FreeBSD.ORG Mon Jul 16 04:55:22 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1B71116A402 for ; Mon, 16 Jul 2007 04:55:22 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from mxout7.cac.washington.edu (mxout7.cac.washington.edu [140.142.32.178]) by mx1.freebsd.org (Postfix) with ESMTP id EC96513C4AC for ; Mon, 16 Jul 2007 04:55:21 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from smtp.washington.edu (smtp.washington.edu [140.142.33.7] (may be forged)) by mxout7.cac.washington.edu (8.13.7+UW06.06/8.13.7+UW07.06) with ESMTP id l6G4tEC3011481 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 15 Jul 2007 21:55:14 -0700 X-Auth-Received: from [192.168.10.45] (c-24-10-12-194.hsd1.ca.comcast.net [24.10.12.194]) (authenticated authid=youshi10) by smtp.washington.edu (8.13.7+UW06.06/8.13.7+UW07.03) with ESMTP id l6G4tDmC031052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 15 Jul 2007 21:55:14 -0700 Message-ID: <469AFA30.4050504@u.washington.edu> Date: Sun, 15 Jul 2007 21:55:12 -0700 From: Garrett Cooper User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: Olivier Nicole References: <000f01c7c56d$da44d640$0200a8c0@satellite> <200707160427.l6G4Rb5q090225@banyan.cs.ait.ac.th> In-Reply-To: <200707160427.l6G4Rb5q090225@banyan.cs.ait.ac.th> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 5.3.2.304607, Antispam-Engine: 2.5.1.298604, Antispam-Data: 2007.7.15.213354 X-Uwash-Spam: Gauge=IIIIIII, Probability=7%, Report='__CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __USER_AGENT 0' Cc: dmehler26@woh.rr.com, freebsd-questions@freebsd.org Subject: Re: cron job every 5 hours X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2007 04:55:22 -0000 Olivier Nicole wrote: >> I want to run an updater script, every 5 hours and x minutes. I thought >> to use: >> >> minute 5 * * * root path/to/scriptname >> >> but that looks like it only works once a day, i want it to go every 5 hours >> not justa at 5 in the monrning. >> > > You could sechedule you jor at 5, 10, 15 and 20 on monday, then 1, 6, > 11, 16 and 21 on Tuesday and etc, but as the number of hours per week > is not a multiple of 5, next week Monday would be at 2, 7, 12, 17 and > 22, and that would not work with cron. > > If you absolutely need it to be 5 hours (6 hours would work nicely > with cron) have your job restart itself with at(1). > > Cron must work on a weekly sechedule. > > bests, > > Olivier Something like: minute */5 * * * root path/to/scriptname will do the trick. Substitute the * in */5 for your desired start time (* being 0). -Garrett PS crond won't do 5 hours and every x number of minutes per job (5 hours + x mins from end to start), just a flat amount of time (5 hours apart from start to start). If you need that type of 'precision', at will solve that like Olivier said if you place it at the end of the command.