misc/129697: periodic/daily/100.clean-disks and port lang/sbcl

Vladimir Chukharev chukharev at mail.ru
Tue Dec 16 15:10:02 PST 2008


>Number:         129697
>Category:       misc
>Synopsis:       periodic/daily/100.clean-disks and port lang/sbcl
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 16 23:10:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Vladimir Chukharev
>Release:        FreeBSD 7.1-PRERELEASE i386
>Organization:
>Environment:
FreeBSD chu.me.tut.fi 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Sat Dec 13 11:26:37 EET 2008     root at chu.me.tut.fi:/usr/obj/usr/src/sys/CHU  i386
>Description:
FreebBSD port lang/sbcl installs a file /usr/local/lib/sbcl/sbcl.core
This file has the name corresponding to the core dumps and it gets
deleted by a cron job /etc/periodic/daily/100.clean-disks if enabled in
/etc/periodic.conf.
>How-To-Repeat:
Install the port lang/sbcl and enable the cron job by setting in /etc/periodic.conf :

daily_clean_disks_enable="YES"
daily_clean_disks_days=0

As root, run /etc/periodic/daily/100.clean-disks
The file /usr/local/lib/sbcl/sbcl.core will be deleted.
>Fix:
The attached patch introduces a new variable daily_clean_disks_ignore
where the port can put a list of files to be kept, e.g. in periodic.conf:
daily_clean_disks_ignore="sbcl.core"

I hope that the port maintainer will add this line e.g. to the port message
when the patch is applied.

Comments?

Patch attached with submission follows:

--- /etc/periodic/daily/100.clean-disks	2007-12-24 12:11:21.000000000 +0200
+++ progs/100.clean-disks	2008-12-17 00:50:59.000000000 +0200
@@ -29,10 +29,18 @@
 	    echo ""
 	    echo "Cleaning disks:"
 	    set -f noglob
-	    args="$args -name "`echo "$daily_clean_disks_files" |
+	    args="$args ( -name "`echo "$daily_clean_disks_files" |
 		sed -e 's/^[ 	]*//' \
 		    -e 's/[ 	]*$//' \
-		    -e 's/[ 	][ 	]*/ -o -name /g'`
+		    -e 's/[ 	][ 	]*/ -o -name /g'`" )"
+
+	    if ! [ -z "$daily_clean_disks_ignore" ]
+		then
+			args="$args -a ! ( -name "`echo "$daily_clean_disks_ignore" |
+			sed -e 's/^[ 	]*//' \
+				-e 's/[ 	]*$//' \
+				-e 's/[ 	][ 	]*/ -o -name /g'`" )"
+		fi
 
 	    case "$daily_clean_disks_verbose" in
 		[Yy][Ee][Ss])
@@ -41,9 +49,9 @@
 		    print=;;
 	    esac
 
-	    rc=$(find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \
-		\( $args \) -atime +$daily_clean_disks_days -delete $print |
-		tee /dev/stderr | wc -l)
+	    command="find / ( ! -fstype local -o -fstype rdonly ) -a -prune -o \
+		( $args ) -atime +$daily_clean_disks_days -delete $print "
+	    rc=$($command | tee /dev/stderr | wc -l)
 	    [ -z "$print" ] && rc=0
 	    [ $rc -gt 1 ] && rc=1
 	    set -f glob


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list