Advertisement
flycat

Search & delete non-open files

Oct 6th, 2011
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.32 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. for filename in `find /opt/ows/store/ -name "*.in.*"`
  4. do
  5.         if lsof -X $filename >/dev/null
  6.         then
  7.                 sync
  8.         else
  9.                 echo "Deleting $filename"
  10.                 rm -f $filename
  11.         fi
  12. done |mail -s "FTP orphea-web.rian.off broken files cleanup" flycat@xxxxxx.ru
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement