find out missing file

find out missing file

Post by Tim_ba.. » Sun, 23 Oct 2005 10:52:21



Just wonder if there are ways to find out any files missing(accidently
deleted) or changed on a system.

Thanks for advice!

 
 
 

find out missing file

Post by ICE » Sun, 23 Oct 2005 18:52:23


For files which are part of a package, you can checkout pkgchk...

-- ICE


Quote:> Just wonder if there are ways to find out any files missing(accidently
> deleted) or changed on a system.

> Thanks for advice!


 
 
 

find out missing file

Post by Tim_ba.. » Sun, 23 Oct 2005 20:50:43


Thanks for reply. Suppose you donot know what file has been removed. Is
there a way?

Thanks!

 
 
 

find out missing file

Post by ICE » Sun, 23 Oct 2005 21:34:03



Quote:> Thanks for reply. Suppose you donot know what file has been removed. Is
> there a way?

> Thanks!

Off hand, I can think of two ways:

1) check every package on the system (verbose) with a script like:

    #!/bin/ksh
    for pkg in $(pkginfo | awk '{print $2}'); do
        pkgchk $pkg
    done

    [ should work on all versions of Solaris ]

2) check each package file individually and report missing ones

    #!/bin/ksh
    for file in $(cat /var/sadm/install/contents | cut -c-256 | awk '{print
$1}'); do
        echo $file | grep '=' >/dev/null 2>&1
        if [ $? -eq 0 ]; then
            link=$(echo $file | sed 's/=.*$//')
            if [ ! -h "$link" ]; then
                echo "$link: symbolic link missing"
            fi
        else
            if [ ! -f $file ]; then
                echo "$file: file missing"
            fi
        fi
    done

    [ won't work on Solaris 10 ]
    [ won't work with pathnames longer than 256 characters - the 'cut' is
there because some lines in /var/sadm/install/contents are too long for awk
to handle ]

Note that files which don't belong to a package can't be checked.

Disclaimer: above scripts written on the fly, so may not be 100% correct...
:)

--
-- ICE
--

 
 
 

find out missing file

Post by Rodrick Brow » Mon, 24 Oct 2005 05:33:35



Quote:> Thanks for reply. Suppose you donot know what file has been removed. Is
> there a way?

> Thanks!

Checkout tripwire.

--
Rodrick R. Brown
Unix Systems Admin
http://www.rodrickbrown.com

When in 1986 Apple bought a Cray X-MP and announced that they would use it
to design the next Apple Macintosh, Seymour Cray replied, "This is very
interesting because I am using an Apple Macintosh to design the Cray-2
supercomputer."

 
 
 

find out missing file

Post by Tim_ba.. » Mon, 24 Oct 2005 06:17:48


not sure what that means.

Thanks!

 
 
 

find out missing file

Post by Logan Sha » Mon, 24 Oct 2005 11:36:20



> not sure what that means.

It means there is software called "tripwire" whose purpose is
to do what it seems like you want:  monitor whether files
change when you're not expecting them to.

   - Logan

 
 
 

find out missing file

Post by Colin B » Wed, 26 Oct 2005 04:20:56



> not sure what that means.

All right then, check out AIDE.