Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Mar 2002 19:02:57 -0600 (CST)
From:      hawkeyd@visi.com (D J Hawkey Jr)
To:        REMORSE@PARTNERS.ORG, freebsd-questions@freebsd.org
Subject:   Re: Question about periodic...
Message-ID:  <200203090102.g2912vp03734@sheol.localdomain>
In-Reply-To: <375F68784081D511908A00508BE3BB17DDDC62_phsexch22.mgh.harvard.edu@ns.sol.net>
References:  <375F68784081D511908A00508BE3BB17DDDC62_phsexch22.mgh.harvard.edu@ns.sol.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203090102.g2912vp03734>