Results 1 to 3 of 3

Thread: Shell Script To watch a Directory

  1. #1
    Join Date
    Oct 2007
    Location
    India
    Beans
    103
    Distro
    Ubuntu 12.04 Precise Pangolin

    Shell Script To watch a Directory

    Hello all,

    I have a windows share mounted on network to a linux computer,on which i am working.In there, i have got a folder called "inbox" and new messages will be put inside it or in a sub directory.All i need is a shell script that will watch my inbox for a new event and display a popup window showing "Pls check your inbox Now" through xmessage or gxmessage or any other variants.

    So, i want to know how can i monitor my inbox or it's sub directories for new event?

    Thanks in advance

  2. #2
    Join Date
    Apr 2009
    Location
    Germany
    Beans
    2,134
    Distro
    Ubuntu Development Release

    Re: Shell Script To watch a Directory

    extremely primitive version:
    Code:
    prev=`du -s folder`;
    while [ 1 ]; do
      cur=`du -s folder`;
      if [ "$cur" != "$prev" ]; then
        #do something
      fi;
      sleep 5
    done
    I remember a pretty niffty python script which this kind if thing in a much better and more flexible way somewhere in this forum, maybe search for it.

  3. #3
    Join Date
    Feb 2007
    Beans
    519
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Shell Script To watch a Directory

    http://projects.l3ib.org/trac/fsniper
    Monitors a folder and executes scripts for new files.
    make install - not war!

    Oh hai!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •