From owner-freebsd-questions Fri Mar 8 17: 4:27 2002 Delivered-To: freebsd-questions@freebsd.org Received: from brea.mc.mpls.visi.com (brea.mc.mpls.visi.com [208.42.156.100]) by hub.freebsd.org (Postfix) with ESMTP id B379E37B48F for ; Fri, 8 Mar 2002 17:03:47 -0800 (PST) Received: from sheol.localdomain (hawkeyd-fw.dsl.visi.com [208.42.101.193]) by brea.mc.mpls.visi.com (Postfix) with ESMTP id 7830D2DDC52; Fri, 8 Mar 2002 19:03:45 -0600 (CST) Received: (from hawkeyd@localhost) by sheol.localdomain (8.11.6/8.11.6) id g2912vp03734; Fri, 8 Mar 2002 19:02:57 -0600 (CST) (envelope-from hawkeyd) Date: Fri, 8 Mar 2002 19:02:57 -0600 (CST) Message-Id: <200203090102.g2912vp03734@sheol.localdomain> Mime-Version: 1.0 X-Newsreader: knews 1.0b.1 Reply-To: hawkeyd@visi.com Organization: if (!FIFO) if (!LIFO) break; References: <375F68784081D511908A00508BE3BB17DDDC62_phsexch22.mgh.harvard.edu@ns.sol.net> In-Reply-To: <375F68784081D511908A00508BE3BB17DDDC62_phsexch22.mgh.harvard.edu@ns.sol.net> From: hawkeyd@visi.com (D J Hawkey Jr) Subject: Re: Question about periodic... X-Original-Newsgroups: sol.lists.freebsd.questions To: REMORSE@PARTNERS.ORG, freebsd-questions@freebsd.org Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In article <375F68784081D511908A00508BE3BB17DDDC62_phsexch22.mgh.harvard.edu@ns.sol.net>, REMORSE@PARTNERS.ORG writes: > Hi! I just recently started using FreeBSD (ie, about 2 weeks ago). So this > might be a really simple answer... > > I want to have CVSup run weekly. I think that it would be nice to include the > output from this run with the rest of the "periodic"ly run scripts -- like the > security report that gets mailed to me every morning. An I understand, I need > to add a script to the weekly configuration for periodic. However, as this is a > local script, I should not add it to the /etc/periodic/weekly/ directory. There > seems to be references to two directories: /usr/local/etc/periodic/ and > /etc/weekly.local/ > > Neither directory exists. > > If I create the directory in /usr/local/etc/ and then add a script directly to > the periodic directory, won't it get executed by all of the periodic runs (ie, > daily, weekly, and monthly)? Or do I create a directory > /usr/local/etc/periodic/weekly/ and put scripts in there? Or should I create > the /etc/weekly.local directory? > > I guess my question is how do I go about adding commands to the weekly run. I asked a similar question just a few days ago, and got a prompt response. I guess that makes it my turn, like "Tag. You're it.". :-) What you've got to do is create /usr/local/etc/periodic and then, depending on how frequently you want your local script to run, create /daily, /weekly, and/or /monthly within that. The next step is highly variable. I have scripts that enhance those found in /etc/periodic/daily, so I copied them from /etc/periodic/daily into /usr/local/etc/periodic/daily, and modified them to suit. I left their names the same. The two things I did _per_script_ to see that they would get run instead of their counterparts in /etc/periodic/daily: - In /etc/periodic.conf, I set them up as: daily_clean_disks_enable="LOCAL" # run the script in /usr/local/etc/periodic daily_clean_disks_excludes="*/home/*" # the local script honors this daily_clean_disks_days="7" daily_clean_tmps_enable="LOCAL" # run the script in /usr/local/etc/perio daily_clean_tmps_prune="NO" # the local script honors this daily_clean_tmps_dirs="/tmp /usr/tmp /var/tmp" daily_clean_tmps_days="7" - In the scripts, I changed the first significant lines to (using the first as an example): case "$daily_clean_disks_enable" in [Ll][Oo][Cc][Aa][Ll]) ... This guarantees that the scripts in /etc/periodic won't be executed, as they test only for case-insensitive "YES", whereas my scripts test for case- insensitive "LOCAL". Scripts in /usr/local/etc/periodic/[daily|weekly|monthly] are automagically run, by their executable existance and configuration in /etc/periodic.conf (see /etc/defaults/periodic.conf). Your situation reads different, but the principles should be the same. Your script variables should go in /etc/periodic.conf, and if your script(s) don't conveniently fit into the existing hierarchy, you'll probably have to muck with /etc/crontab to add an entry, after reading the periodic man page. > Thanks, > Ricky Hope I didn't miss anything, or get it all wrong, Dave -- Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message