tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Ignoring subdirectories in daily's find_core



So, what about integrating the attached patch?
--- daily.orig  2012-07-27 14:41:28.000000000 +0200
+++ daily       2012-07-27 15:31:12.000000000 +0200
@@ -89,7 +89,16 @@
        ignfstypes="$(echo $find_core_ignore_fstypes | \
                sed -e's/\(!*\)\([^[:space:]]\{1,\}\)/-o \1 -fstype \2/g' \
                    -e's/^-o //')"
+       # Turn "foo bar" into "( -path foo -o -path bar ) -prune -o"
+       # Set ignpaths empty if no find_core_ignore_paths given
+       if [ -n "$find_core_ignore_paths" ]; then
+               ignpaths="$(printf " -o -path %s" $find_core_ignore_paths)"
+               ignpaths="( ${ignpaths# -o } ) -prune -o"
+       else
+               ignpaths=""
+       fi
        find / \( $ignfstypes \) -prune -o \
+               ${ignpaths} \
                -name 'lost+found' -prune -o \
                \( -name '*.core' -o -name 'core' \) -type f -print > $TMP
 #              \( -name '[#,]*' -o -name '.#*' -o -name a.out \
--- daily.conf.orig     2012-07-27 15:17:32.000000000 +0200
+++ daily.conf  2012-07-27 15:18:05.000000000 +0200
@@ -11,6 +11,7 @@
 
 find_core=YES
 find_core_ignore_fstypes="!local rdonly fdesc null kernfs procfs ptyfs"
+find_core_ignore_paths=""
 expire_news=NO
 purge_accounting=YES
 run_msgs=YES
--- daily.5.orig        2012-07-27 14:41:51.000000000 +0200
+++ daily.5     2012-07-27 15:22:23.000000000 +0200
@@ -168,6 +168,16 @@
 .Ql procfs
 type filesystems and filesystems that are not
 .Ql local .
+.It Sy find_core_ignore_paths
+Lists paths to ignore during the
+.Sy find_core
+phase.
+For example,
+.Ql /export
+will not descend into any directories under the
+.Ql /export
+hierarchy. This, on a file server, allows to skip
+user data while still scanning system files.
 .It Sy run_fsck_flags
 Extra options to be passed to
 .Xr fsck 8


Home | Main Index | Thread Index | Old Index