Find the answer to your Linux question:
Results 1 to 3 of 3
On server-1 ,a shell script runs and scp the tar files to /opt in server-2. Now I want to check specific directory( /opt ) in server-2 for new arrivals and ...
  1. #1
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568

    monitor directoriese : inotify or shell script while-true loop?

    On server-1 ,a shell script runs and scp the tar files to /opt in server-2. Now I want to check specific directory( /opt ) in server-2 for new arrivals and process them.

    I have found two ways of doing it,
    use inotify simple C program watches /opt
    or a shell something like
    Code:
    while true; do
    sleep 30;
    ls -tr /opt| head -1
    done
    Which one is better?
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  2. #2
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422
    Doubt it really matters but I'd go for the C way.
    New Users, please read this..
    Google first, then ask..

  3. #3
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568
    yes,Robin I have used inotify
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

Posting Permissions

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