From owner-freebsd-questions Thu Aug 5 11: 9:27 1999 Delivered-To: freebsd-questions@freebsd.org Received: from aero.org (aero.org [130.221.16.2]) by hub.freebsd.org (Postfix) with ESMTP id 81C6A15531 for ; Thu, 5 Aug 1999 11:09:11 -0700 (PDT) (envelope-from dylan@rush.aero.org) Received: from rush.aero.org ([130.221.201.83]) by aero.org with ESMTP id <111160-1>; Thu, 5 Aug 1999 11:07:20 -0700 Received: (from dylan@localhost) by rush.aero.org (8.9.3/8.9.3) id LAA18122; Thu, 5 Aug 1999 11:07:10 -0700 (PDT) Date: Thu, 5 Aug 1999 11:07:10 -0700 From: "Dylan A. Loomis" To: Martin Lilienthal Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Help with Shell Script..... Message-ID: <19990805110703.B14296@rush.aero.org> Reply-To: "Dylan A. Loomis" References: <199908051625.LAA13061@db.geocrawler.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.5i In-Reply-To: <199908051625.LAA13061@db.geocrawler.com>; from Geocrawler.com on Thu, Aug 05, 1999 at 09:25:11AM -0700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Aug 05, 1999 at 09:25:11AM -0700, Geocrawler.com wrote: > This message was sent from Geocrawler.com by "Martin Lilienthal" > Be sure to reply to that address. > > I need some help with writing a Shell-Script. > (I`m not very experienced with writing these Scripts.) > The Script should be started by cron to create access-statistics for our website. > The command to start the analizer is: > > webalizer -o admin/stats logs/access.log.XX > > XX is the number of the week. For example the full name of the access-log > is: access.log.31 . How can I force the script, that it automaticalliy > changes the logfile-name? > > regards, Martin > > Geocrawler.com - The Knowledge Archive > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message Martin, $ date +%U Will print out the week of the year 00-53 accd'ing to strftime(3) man page. So there are a number of ways to do it: try the short way just add this to the crontab: webalizer -o admin/stats logs/access.log.`date +%U` Or the long way create a shell script like: -- begin test.sh -- #! /bin/sh week=`date +%U` webalizer -o admin/stats logs/access.log.${week} -- end test.sh -- And add the shell script to the crontab. hope that helps -DAL- -- Dylan A. Loomis Computer Systems Research Department The Aerospace Corporation e-mail: dylan@aero.org phone: (310) 336-2449 PGP Key fingerprint = 55 DE BB DD 34 10 CD 20 72 79 88 FE 02 0E 21 3A PGP 2.6.2 key available upon request To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message