Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

findcruft: Yet another script to find obsolete files

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
78 posts
  • 1
  • 2
  • 3
  • 4
  • Next
Author
Message
hepta_sean
Apprentice
Apprentice
User avatar
Posts: 246
Joined: Tue Apr 27, 2004 9:45 pm
Location: Berlin, Germany

findcruft: Yet another script to find obsolete files

  • Quote

Post by hepta_sean » Fri Nov 19, 2004 4:07 am

Hello!

EDIT: Last version is 1.0.4.

This is a script, which I wrote as a successor to the great cruft script by ecatmur.
Unfortunately ecatmur is not really maintaining this thing anymore, so I wrote a similar script borrowing some parts of cruft but trying to avoid some of the shortcomings of it.
(I think Ed wrote a successor himself - cruft2.py - but he never announced it and I don't know if he's working on it.)

The pretty verbose help message for this beast follows:
findcruft -h wrote:findcruft v1.0.4

Usage:
findcruft [ -h | -? ]
findcruft [ -D ] [ -f targetdir ]
findcruft > cruftlist
FINDCRUFT_CONFDIR=/path/to/confdir findcruft

Options:
-h:
Print this help message and exit.
-?:
Print short usage information and exit.
-D:
Switch to debug mode. Gives some diagnostic
information and does not clean the temporary
files after finishing.
-f targetdir:
Switch to force mode. Found cruft is packed
into a tar.bz2 archive in targetdir and
deleted.

This program compares the files on your filesystem to the ones
managed by portage and prints out files which do not belong to
any package.

Additionally it uses the files in /usr/local/lib/findcruft to
exclude false positives, i.e. configuration and similar files
which are not managed by portage, but should nevertheless be on
the system. You can manipulate the location of this directory
by the FINDCRUFT_CONFDIR environment variable.

All of the files in this directory are sourced into findcruft
(and hence processed by bash). Thus, you can use all of bash's
programming features. Additionally the following portage settings
are grabbed from the configuration and can be used in all files:
$PORTDIR, $DISTDIR, $PKGDIR, $PORT_LOGDIR, $PORTDIR_OVERLAY,
$PORTAGE_TMPDIR, $CCACHE_DIR, $ARCH, and $CHOST

The file ignore should output a list of directories which will
be completely ignored, i.e. they are neither searched during the
find phase nor during the building of the false positive list (as
long as you do not do it in your nopackage.local). You can also
add your own additions in an ignore.local file. This is handy if
you have some network file systems or similar which you do not
want to put under too heavy load.

The file symlink should output a list of symlink-target pairs,
which is applied to the contents of packages managed by portage.
This is necessary, because some packages install their files
e.g. into /usr/man, but this is a symlink to /usr/share/man.

You can add your own symlinks to symlink.local. For example if
/opt is a symlink to /usr/opt (because /opt was too big for the
root partition and you wanted it to be on the /usr partition
together with the other large applications) then add a line
echo /opt /usr/opt to symlink.local.

The other files are expected to output a list of false positive
files one file per line onto stdout. So, if you want to ignore
a single file you can just do echo /full/path/to/file. You can
use the predefined functions cruftfile /full/path/file_regexp and
cruftdir /full/path/dir_regexp, which do a grep on the unmanaged
files and ignore all files matching the given regexp or all
directories matching the regexp and their contents, respectively.
Look into the included files for more elaborated examples.

You can also use the functions from the file functions in these
rule files:
* nsplugin plugin.so plugin.a plugin.la adds all files given as
arguments to the false positives in the plugin directory for
Netscape style browsers (Mozilla, Firefox, ...).
* fontdir relative/path /absolute/path adds the generated cache,
directory, and scale files for font directories to the false
positives. If a relative path is given the directory is assumed
to reside under /usr/share/fonts.
* xpiapp relative/path /absolute/path adds the typical false
positives for XPI applications such as Mozilla and Firefox to
the list (i.e. things in the chrome and components directories,
etc.). Relative pathes are assumed under /usr/lib.

The file nopackage contains a list of false positives without
corresponding package (for some of these one might argue, that
they belong to some of the base packages, which are present on
any system, perhaps they will be moved to the corresponding
package sometime). The file nopackage.local can be used for
local settings.

The rest of the files is organized in a category/package
hierarchy. If a package is present on the system (according to
/var/db/pkg) the corresponding file is sourced with the
variables $VERSION set to the version and $SLOT set to the slot
of the package.

Please make additions to ignore, symlink, and nopackage in the
corresponding *.local files, so that they do not get overwritten,
when you unpack a new rule archive into the directory.
It is really easy to install:

Code: Select all

$ cd
$ wget http://user.cs.tu-berlin.de/~sean/findcruft-1.0.4.tar.bz2
$ cd /usr/local
$ su -c "tar -xjf ${HOME}/findcruft-1.0.4.tar.bz2"
Now you can test it:

Code: Select all

$ findcruft > cruftfiles
EDIT: You do not have to be root to run this script anymore. It will however try to do "su -c" if it needs root permissions. At these points you might have to give a password.

The files listed are the ones findcruft couldn't find a reason to exist for.
You can consider to delete them, but beware: They might as well be important application data.

If you think they are false positives and know to which package they belong you can create/edit a rule file in /usr/local/lib/findcruft/<category>/<package>.
Then, we can exchange these rule files in this thread and build new rule archives from time to time.
If it is a false positive due to a personal/local setting on your machine, you can add it into /usr/local/lib/findcruft/nopackage.local.
There it won't interfere with the exchanged rules.

Greetings,
sean
Last edited by hepta_sean on Tue Nov 30, 2004 12:30 am, edited 3 times in total.
Top
tlaloctlaloc
Apprentice
Apprentice
User avatar
Posts: 198
Joined: Wed Feb 11, 2004 9:55 am
Location: Europe-In the heart of the Alps

  • Quote

Post by tlaloctlaloc » Fri Nov 19, 2004 9:04 am

Download is not possible....'Connection refused'.
Bye.
Top
dzho002
n00b
n00b
Posts: 43
Joined: Tue Mar 23, 2004 10:05 pm

  • Quote

Post by dzho002 » Fri Nov 19, 2004 10:46 am

Same to me :roll:

Code: Select all

 wget http://user.cs.tu-berlin.de/~sean/findcruft-1.0.0.tar.bz2
--23:45:44--  http://user.cs.tu-berlin.de/%7Esean/findcruft-1.0.0.tar.bz2
           => `findcruft-1.0.0.tar.bz2'
Resolving user.cs.tu-berlin.de... 130.149.17.156
Connecting to user.cs.tu-berlin.de[130.149.17.156]:80... failed: Connection refused.
why not?
Top
hepta_sean
Apprentice
Apprentice
User avatar
Posts: 246
Joined: Tue Apr 27, 2004 9:45 pm
Location: Berlin, Germany

  • Quote

Post by hepta_sean » Fri Nov 19, 2004 12:05 pm

Ugh! Sorry for that!

The file server at the university was down. It has some problems this week.

But ATM it's up again. In case this happens again, I have mirrored it on another server:

Code: Select all

$ wget http://tfs.cs.tu-berlin.de/~bbraatz/findcruft-1.0.0.tar.bz2
Greetings,
sean
Top
soulwarrior
Guru
Guru
Posts: 331
Joined: Mon Oct 21, 2002 7:35 pm

  • Quote

Post by soulwarrior » Fri Nov 19, 2004 5:00 pm

So far I use this lines in my nopackage.local to accomodate to mysql, nessus & postgresql:

Code: Select all

# for nessus
find /usr/lib/nessus/plugins
find /var/lib/nessus

# for mysql databases
find /var/lib/mysql

# for postgresql databases
find /var/lib/postgresql/data
Maybe this should be moved to the category/package hierarchy?
Top
Wyckliff
n00b
n00b
Posts: 7
Joined: Fri May 14, 2004 1:21 pm

network filesystems

  • Quote

Post by Wyckliff » Tue Nov 23, 2004 7:45 pm

Nice script, hepta_sean!
Could it be modified to not check network filesystems?
Thanks.
Top
wescott
Apprentice
Apprentice
User avatar
Posts: 183
Joined: Wed Feb 18, 2004 2:58 pm
Location: A giant shoe
Contact:
Contact wescott
Website

  • Quote

Post by wescott » Wed Nov 24, 2004 7:50 pm

xf86Config came up on mine. I know that one is a false-positive :wink: .


Also, I got alot of results in /usr/bin 8O
c++
cc
cpp
g++

...

i686-pc-linux-gnu-c++
i686-pc-linux-gnu-g++
i686-pc-linux-gnu-gcc

...

mtrace
yacc
libdb.a
if all of these (and those I left out) truely are false positives, shouldn't /usr/bin be overlooked?
Sometimes you feel like a nut, sometimes you don't
Gentoo Forum Member #43303

Yoda of Borg are we: Futile is resistance. Assimilate you, we will.
Top
teedog
Apprentice
Apprentice
Posts: 211
Joined: Tue Mar 09, 2004 3:53 am

  • Quote

Post by teedog » Thu Nov 25, 2004 7:23 am

I wonder if the Gentoo team has plans to officially support/develop some kind of cruft-cleaning script or program like this? Seems like they are very popular with the obsessive-compulsive Gentoo community. :)
Top
hepta_sean
Apprentice
Apprentice
User avatar
Posts: 246
Joined: Tue Apr 27, 2004 9:45 pm
Location: Berlin, Germany

  • Quote

Post by hepta_sean » Thu Nov 25, 2004 6:07 pm

wescott wrote:xf86Config came up on mine. I know that one is a false-positive :wink: .
Do you mean the program (I think there was one on xfree) or the configuration file /etc/X11/XF86Config?
Do you use xorg.conf? Then it should be either xorgconfig/xorgcfg (the program) or xorg.conf (the configuration file) and the old one is really cruft.

I don't know, which conf file is used if both - XF86Config and xorg.conf - are there (xorg honours the old xf86Configs), so be careful (make some backups in your home dir, before deleting/overwriting).

If you still use xfree, I'll add that one.
wescott wrote:Also, I got alot of results in /usr/bin 8O
c++
cc
cpp
g++
...
i686-pc-linux-gnu-c++
i686-pc-linux-gnu-g++
i686-pc-linux-gnu-gcc
...
mtrace
yacc
libdb.a
c++, cpp, g++, i686-pc-linux-gnu-* and co belong to gcc-config on my system:

Code: Select all

sean@lois ~ $ grep /usr/bin/c++ /var/db/pkg/*/*/CONTENTS
/var/db/pkg/sys-devel/gcc-config-1.3.7-r1/CONTENTS:obj /usr/bin/c++ 0bda93acb31d794b3c0d457371f8b306 1098884742
sean@lois ~ $ grep /usr/bin/i686-pc-linux-gnu-c++ /var/db/pkg/*/*/CONTENTS
/var/db/pkg/sys-devel/gcc-config-1.3.7-r1/CONTENTS:obj /usr/bin/i686-pc-linux-gnu-c++ 0bda93acb31d794b3c0d457371f8b306 1098884742
mtrace belongs to glibc:

Code: Select all

sean@lois ~ $ grep /usr/bin/mtrace /var/db/pkg/*/*/CONTENTS
/var/db/pkg/sys-libs/glibc-2.3.4.20041102/CONTENTS:obj /usr/bin/mtrace 5a9cddd7824dae746ecd48c209f5892c 1099945949
yacc belongs to yacc (who would have thought? :wink:):

Code: Select all

sean@lois ~ $ grep /usr/bin/yacc /var/db/pkg/*/*/CONTENTS
/var/db/pkg/dev-util/yacc-1.9.1-r2/CONTENTS:obj /usr/bin/yacc d1788f9a38ae04b5efede90f50390aa1 1088787310
So, all of these shouldn't be reported (the contents of all CONTENTS files are not reported - that's the main functionality of this script).
Something must be really odd on your system.
Do you have those packages?
What's the result of the grep statements above on your system?
Have you compiled/installed them by hand?
Have you unpacked some kind of rescue or stage tarball without (re-)emerging the corresponding packages afterwards?
wescott wrote:if all of these (and those I left out) truely are false positives, shouldn't /usr/bin be overlooked?
They shouldn't be reported. /usr/bin should be checked, 'cause it is managed by portage. Only false positives should be things generated in post-installs (rarely) and symlinks (if you use binary packages they are not overwritten on updates and are not considered contents of the package).

To the others: I hope I will get your suggestions in tonight (CET).

Greetings,
sean
Last edited by hepta_sean on Fri Nov 26, 2004 12:09 pm, edited 1 time in total.
Top
hepta_sean
Apprentice
Apprentice
User avatar
Posts: 246
Joined: Tue Apr 27, 2004 9:45 pm
Location: Berlin, Germany

  • Quote

Post by hepta_sean » Fri Nov 26, 2004 12:05 am

O.K., I just uploaded the new version:

Code: Select all

wget http://user.cs.tu-berlin.de/~sean/findcruft-1.0.2.tar.bz2
soulwarrior wrote:So far I use this lines in my nopackage.local to accomodate to mysql, nessus & postgresql:

Code: Select all

...
Maybe this should be moved to the category/package hierarchy?
Done!
Wyckliff wrote:Nice script, hepta_sean!
Thanks!
Wyckliff wrote:Could it be modified to not check network filesystems?
I modified it, so that the ignored directories are not hardcoded anymore, but are echoed to stdout by ignore in /usr/local/lib/findcruft. So there are two possibilities:
1.) You let your network filesystems be echoed by ignore.local.
2.) You write a nice piece of code, which parses fstab or mtab and puts out the filesystems, which are network filesystems.

Up to now, these directories are only ignored in the "Finding files on your filesystem ..." phase. If a find or cruftdir is used in the "Building false positive list ..." phase the filesystems are still accessed.

Hope, that helps.

Greetings,
sean
Top
Sonderblade
n00b
n00b
Posts: 10
Joined: Sun Aug 01, 2004 4:08 pm

  • Quote

Post by Sonderblade » Fri Nov 26, 2004 1:02 am

Would it be possible to make it so it doesn't have to be run as root everytime? It feels unsafe.
Top
stahlsau
Guru
Guru
User avatar
Posts: 584
Joined: Fri Jan 09, 2004 8:16 am
Location: WildWestwoods

  • Quote

Post by stahlsau » Fri Nov 26, 2004 6:39 am

Would it be possible to make it so it doesn't have to be run as root everytime? It feels unsafe.
Since, as user, you don´t have read-access to all the systems directories, how should that work? don´t think it´s possible.

BTW, nice script, works better for me that the "old" cruft script.
Top
hepta_sean
Apprentice
Apprentice
User avatar
Posts: 246
Joined: Tue Apr 27, 2004 9:45 pm
Location: Berlin, Germany

  • Quote

Post by hepta_sean » Fri Nov 26, 2004 12:07 pm

stahlsau wrote:
Would it be possible to make it so it doesn't have to be run as root everytime? It feels unsafe.
Since, as user, you don´t have read-access to all the systems directories, how should that work? don´t think it´s possible.
On my system there is only a small number of directories for which root access is really necessary:

Code: Select all

sean@lois ~ $ findcruft
Finding files on the filesystem ...
find: /etc/cups/certs: Permission denied
find: /etc/samba/private: Permission denied
find: /var/lib/xdm: Permission denied
find: /var/lib/samba/private: Permission denied
find: /var/lib/slocate: Permission denied
find: /var/spool/cron: Permission denied
find: /var/spool/cups: Permission denied
Finding files managed by portage ...
Comparing to get unmanaged files ...
Building false positive list ...
find: /etc/samba/private: Permission denied
find: /var/lib/samba/private: Permission denied
find: /etc/cups/certs: Permission denied
find: /var/spool/cups: Permission denied
Comparing to get cruft files ...
findcruft thinks these files are cruft:
---------------------------------------
/etc/.fstab.hal.f
/etc/.fstab.hal.i
/etc/samba/private
/var/spool/cups
--------------------------------------------------
Please check carefully, before removing any files!
Cleaning up ...
I could monitor the find commands to record all "Permission denied" complaints and then just sudo or su -c for these. The rest of the script can run as user. I'll add that to my TODO list.

Until then, the extra paranoid user can run it as user and just ignore the "Permission denied"s and possible cruft reports due to these.
stahlsau wrote:BTW, nice script, works better for me that the "old" cruft script.
Thanks! I hope, I'll maintain it a little longer (too bad, that ecatmur is gone). And I'm planning on also writing a successor to "dep", but that's far more ambitious ...

Greetings,
sean
Top
stahlsau
Guru
Guru
User avatar
Posts: 584
Joined: Fri Jan 09, 2004 8:16 am
Location: WildWestwoods

  • Quote

Post by stahlsau » Fri Nov 26, 2004 2:37 pm

arm, a little OT:
do my posting´s apostrophes "´" look weird? For me they look normal, as they should, but if s/o quotes my posts, they show up as a "´", whatever that may be...
Please give feedback so that i can correct it if it displays wrong.
Top
soulwarrior
Guru
Guru
Posts: 331
Joined: Mon Oct 21, 2002 7:35 pm

  • Quote

Post by soulwarrior » Fri Nov 26, 2004 5:10 pm

hepta_sean wrote:
soulwarrior wrote:So far I use this lines in my nopackage.local to accomodate to mysql, nessus & postgresql:

Code: Select all

...
Maybe this should be moved to the category/package hierarchy?
Done!
thanks :D

I will test your new version.

Maybe it would be nice to add to findcruft a flag, which would put every cruft file in a tar-archiv and delete the cruft files afterwards.
One would have to set the directory, where to store the archiv, in a config file.

Like that one could in the worst case, reboot into a livecd and undo what should not have been done :wink:

Of course one could perform this steps manually, but adding this functionality to findcruft would be nice.

What do you think?
Top
GentooBox
Veteran
Veteran
User avatar
Posts: 1168
Joined: Sun Jun 22, 2003 10:52 am
Location: Denmark

  • Quote

Post by GentooBox » Fri Nov 26, 2004 7:19 pm

The script finds a lot of stuff in my /dev/ folder.
and also all my files in /mnt/backup

I have amd64, it also finds all files in /lib64/

Code: Select all

du -h cruft
16M     cruft
thats a lot of "cruft"....
Encrypt, lock up everything and duct tape the rest
Top
soulwarrior
Guru
Guru
Posts: 331
Joined: Mon Oct 21, 2002 7:35 pm

[edit]

  • Quote

Post by soulwarrior » Sat Nov 27, 2004 9:03 pm

Just did a fresh install of fcron and findcruft wants to delete this files:

Code: Select all

/var/spool/cron/fcrontabs/root
/var/spool/cron/fcrontabs/root.orig
I think fcron generates these files at runtime.

Postfix seems to need some files under /var/spool/postfix to function correctly, which findcruft wants to remove, so I adde the following line to nopacke.local:

Code: Select all

find /var/spool/postfix
Top
hepta_sean
Apprentice
Apprentice
User avatar
Posts: 246
Joined: Tue Apr 27, 2004 9:45 pm
Location: Berlin, Germany

  • Quote

Post by hepta_sean » Mon Nov 29, 2004 1:11 am

Hello!

I did a new version:

Code: Select all

wget http://user.cs.tu-berlin.de/~sean/findcruft-1.0.3.tar.bz2
Sonderblade wrote:Would it be possible to make it so it doesn't have to be run as root everytime? It feels unsafe.
It now works for normal users and only does "su -c" when necessary.
If you do not allow users in the wheel group to "su" without password, you'll have to enter the root password for each of these actions - once in finding files and several times in force mode (see below).
soulwarrior wrote:Maybe it would be nice to add to findcruft a flag, which would put every cruft file in a tar-archiv and delete the cruft files afterwards.
One would have to set the directory, where to store the archiv, in a config file.
You can now do something like:

Code: Select all

findcruft -f /root
The script will store an archive "cruft-<date>-<number>.tar.bz2" in "/root" (for this example) with all found cruft files in it. It will then delete these files (directories are tried to be removed by "rmdir" - that way you will get an error message if only the directory is suspected to be cruft but not its contents).
It will "su" once for creation of the archive and once for each cruft file. That will be a lot of password typing for those who do not use one of the "su without password" options.
Attention: Please be careful with this option! Only use it if you do not have any false positives left. You can use the archives to restore, but you will perhaps need to boot into a live-cd.
soulwarrior wrote:Just did a fresh install of fcron and findcruft wants to delete this files:

Code: Select all

/var/spool/cron/fcrontabs/root
/var/spool/cron/fcrontabs/root.orig
...
Postfix seems to need some files under /var/spool/postfix to function correctly
Added to the corresponding category/package files.

Moreover, I rewrote the "cruftdir" function to not use "find" anymore (we already did a "find" for the whole filesystem in the first phase). Now "cruftfile" and "cruftdir" do "grep" on the unmanaged files. Should be a little faster, cannot get into permission problems and you can use grep's regular expressions.

I also added a debug flag ("-D"), which gives a lot of information on what is happening (variables and sourced configuration files) and prevents the removal of the temporary files in "/tmp/findcruft-*".
GentooBox wrote:The script finds a lot of stuff in my /dev/ folder.
and also all my files in /mnt/backup
These should be ignored! Please try the latest version with the debug option.
It should output (among a lot of other stuff):

Code: Select all

sean@lois ~ $ findcruft -D
...
DEBUG: Sourcing /usr/local/lib/findcruft/ignore.
DEBUG: $IGNORE=/boot /dev /home /media /mnt /proc /root /srv /sys /tmp /usr/local /timestamp.chk /usr/portage /usr/portage/distfiles /usr/portage/packages /var/log/portage /usr/local/portage/manual /var/tmp/portage /var/tmp/portage-pkg /var/tmp/sync /var/tmp/timestamp.chk /var/tmp/ccache /var/cache/edb /var/db/pkg
Finding files on the filesystem ...
...
GentooBox wrote:I have amd64, it also finds all files in /lib64/
I added this to "nopackage" for $ARCH="amd64". Do they really not belong to any package?
stahlsau wrote:arm, a little OT:
do my posting´s apostrophes "´" look weird? For me they look normal, as they should, but if s/o quotes my posts, they show up as a "´", whatever that may be...
Please give feedback so that i can correct it if it displays wrong.
Yeah, your apostrophes ("'") look like single quotes ("´"). I don't know, why ... :?

Greetings,
sean
Top
hepta_sean
Apprentice
Apprentice
User avatar
Posts: 246
Joined: Tue Apr 27, 2004 9:45 pm
Location: Berlin, Germany

  • Quote

Post by hepta_sean » Tue Nov 30, 2004 12:27 am

Bugfix release:

Code: Select all

wget http://user.cs.tu-berlin.de/~sean/findcruft-1.0.4.tar.bz2
The force mode didn't work with files containing special characters like | or $. Fixed that. Nothing else new.

Greetings,
sean
Top
soulwarrior
Guru
Guru
Posts: 331
Joined: Mon Oct 21, 2002 7:35 pm

  • Quote

Post by soulwarrior » Tue Nov 30, 2004 4:52 pm

hepta_sean wrote: The script will store an archive "cruft-<date>-<number>.tar.bz2" in "/root" (for this example) with all found cruft files in it. It will then delete these files (directories are tried to be removed by "rmdir" - that way you will get an error message if only the directory is suspected to be cruft but not its contents).
Thanks :D


I have some more false postives:

Code: Select all

#
# vixie-cron stores the different cron jobs of the users in /var/spool/cron/crontabs/
# only delete the crontabs of users, which don't exist (anymore) on the system
#
for x in /var/spool/cron/crontabs/*
do
    name=`basename $x`
    if [ `grep "^$name:" /etc/passwd` ]
    then
        echo $x
    fi
done

#
# cups-pdf stores the pdf's by default in this directory
# remove directories from non-existant users
echo /var/spool/cups-pdf
echo /var/spool/cups-pdf/SPOOL
for x in /var/spool/cups-pdf/*
do
    name=`basename $x`
    if [ `grep "^$name:" /etc/passwd` ]
    then
        echo $x
    fi
done


#
# mysql stores it's pid & sock in this dir
# only remove it when mysql is not running
#
if [ -n "`/usr/bin/pidof mysqld`" ]
then
    echo /var/run/mysqld/mysqld.pid;
    echo /var/run/mysqld/mysqld.sock;
fi
# don't remove it's log files
cruftdir /var/log/mysql


#
# pid of apache2
# only to be removed, when apache2 is not running
#
if [ -n "`/usr/bin/pidof apache2`" ]
then
    echo /var/run/apache2.pid;
fi
# don't remove it's log files
cruftdir /var/log/apache2


#
# sys-apps/acpid
#
echo /var/log/acpid

Could there be a better way to take into account pid-files or log-files the programs generate at runtime?
Top
chunderbunny
Veteran
Veteran
User avatar
Posts: 1281
Joined: Mon May 31, 2004 11:28 am
Location: 51°24'27" N, 0°57'15" W

  • Quote

Post by chunderbunny » Tue Nov 30, 2004 9:44 pm

Ok, it picked up /etc/portage/profile/virtuals which is a portage config file (user created) which I don't think it should.
Top
soulwarrior
Guru
Guru
Posts: 331
Joined: Mon Oct 21, 2002 7:35 pm

  • Quote

Post by soulwarrior » Wed Dec 01, 2004 7:20 am

I just wondered why findruft did also pickup socket files, so I looked into the findcruft script and saw that find didn't include the "-type f" option.

Maybe it would be an idea to use the "-type f" option for find to only take "real" files into account, or was there an reason to not use this option?
Top
hepta_sean
Apprentice
Apprentice
User avatar
Posts: 246
Joined: Tue Apr 27, 2004 9:45 pm
Location: Berlin, Germany

  • Quote

Post by hepta_sean » Wed Dec 01, 2004 8:02 am

soulwarrior wrote:Maybe it would be an idea to use the "-type f" option for find to only take "real" files into account, or was there an reason to not use this option?
I think, I won't do that, since on the one hand "-type f" would also exclude directories (o.k., we could do "-type f -or -type d"), on the other hand, I don't want to exclude sockets, because parts of the most regular cruft on my system are sockets, which are left over e.g. when entrance is not terminated properly.

So, let's just add the sockets to the false positive files. (Most programs create them in /tmp anyway).

I'll look into the other things this weekend.

Greetings,
sean
Top
soulwarrior
Guru
Guru
Posts: 331
Joined: Mon Oct 21, 2002 7:35 pm

  • Quote

Post by soulwarrior » Wed Dec 01, 2004 10:33 am

hepta_sean wrote: I think, I won't do that, since on the one hand "-type f" would also exclude directories (o.k., we could do "-type f -or -type d"), on the other hand, I don't want to exclude sockets, because parts of the most regular cruft on my system are sockets, which are left over e.g. when entrance is not terminated properly.

So, let's just add the sockets to the false positive files. (Most programs create them in /tmp anyway).
Okay, I understand. I thought dead sockets wouldn't survive a reboot. So it is in fact better to include the sockets.

Or could one maybe specifically search for dead sockets on a system?
hepta_sean wrote: I'll look into the other things this weekend.
thanks :)

Greetings,
soulwarrior
Top
djpenguin
Guru
Guru
User avatar
Posts: 386
Joined: Thu Sep 02, 2004 11:44 pm

  • Quote

Post by djpenguin » Fri Dec 03, 2004 9:23 pm

Hey, I've installed your script, but I can't seem to get it to work right...

After getting the latest version:

Code: Select all

bash-2.05b$ cd /usr/local/
bash-2.05b$ su -c "tar -xvjf /tmp/findcruft-1.0.4.tar.bz2"
But when I go to try it out:

Code: Select all

bash-2.05b$ findcruft > cruftfiles
bash: cruftfiles: Permission denied
bash-2.05b$ su root
Password: 
bash-2.05b# findcruft > cruftfiles
bash: findcruft: command not found
bash-2.05b# su djpenguin
bash-2.05b$ findcruft > cruftfiles
bash: cruftfiles: Permission denied
bash-2.05b$ source /etc/profile
djpenguin@chilly-willy local $ findcruft > cruftfiles 
bash: cruftfiles: Permission denied
Any idea what I did wrong? I'd really like to get this going...had to go in a manually remove stuff from /var/tmp/ today so I could do an emerge sync...
Top
Post Reply

78 posts
  • 1
  • 2
  • 3
  • 4
  • Next

Return to “Unsupported Software”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Authors
Gentoo is a trademark of the Gentoo Foundation, Inc. and of Förderverein Gentoo e.V.
The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-4.0 license.
The Gentoo Name and Logo Usage Guidelines apply.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy