Monitor filesystem for deletions

On a project I'm working on at the moment we have a problem, files are going missing.

We don't know which part of the system could be trashing these files (user uploaded images in this case) and they are on a shared filesystem so there are plenty of places to point fingers.

I've discovered a very handy toolset inotify-tools Which hooks into the linix kernel and allows you to monitor actions like file deletion.

I my case all I need to do right now is monitor the files on each sytem that has access - and I'm hoping to catch which one does the delete


# stop monitoring for deletes through the build
[ -f ~/inotifywait.pid ] && kill $(cat ~/inotifywait.pid)

git pull
./build.sh

# if the tool is installed - monitor file delets
which inotifywait &-$(BUILD_NUMBER)-delete.log &
echo $! > ~/inotifywait.pid
}

This should create a log of any user files that get deleted between builds

Tags

Post new comment

Got something to add - just enter a comment
all other fields are optional.

Your email address will not be published.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options