Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 08 Jun 2000 18:37:29 +0100
From:      Brian Somers <brian@Awfulhak.org>
To:        Clive Lin <clive@CirX.ORG>
Cc:        Valentin Nechayev <netch@lucky.net>, Brian Somers <brian@FreeBSD.ORG>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG, brian@hak.lan.Awfulhak.org
Subject:   Re: cvs commit: src/etc/periodic/daily 110.clean-tmps 
Message-ID:  <200006081737.SAA20584@hak.lan.Awfulhak.org>
In-Reply-To: Message from Clive Lin <clive@CirX.ORG>  of "Thu, 08 Jun 2000 21:15:49 %2B0800." <20000608211549.A7556@cartier.cirx.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
>     So, I suggest (yeah, just suggest..) put $clear_tmp_daily and related
> stuffs into rc.conf and let this periodic script be consistent with it...
> 
> Regards,
> Clive

How about something more like this:

if [ -n "$clear_daily_days" ]
then
    echo ""
    echo "Removing old temporary files:"

    set -f noglob
    args="-atime +$clear_daily_days -mtime +$clear_daily_days"
    [ -n "$clear_daily_ignore" ] &&
        args="$args "`echo " ${clear_daily_ignore% }" |
            sed 's/[    ][      ]*/ ! -name /g'`

    for dir in $clear_daily_dirs
    do
        [ "${dir#/}" = "$dir" ] && continue     # Only absolute directories

        [ -d $dir ] && cd $dir && {
            find -d . -type f $args -delete
            find -d . ! -name . -type d -mtime +$clear_daily_days -delete
        }
    done
    set -f glob
fi

With this in defaults/rc.conf:

clear_daily_ignore=".X*-lock quota.user quota.group" # Don't delete these
clear_daily_dirs="/tmp /var/tmp /compat/linux/tmp"   # Delete stuff here
clear_daily_days=                                    # Older than this (3?)

and rc.conf.5 updated accordingly ?
-- 
Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
      <http://www.Awfulhak.org>;                   <brian@[uk.]OpenBSD.org>
Don't _EVER_ lose your sense of humour !




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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