how to run inotifywait background

Discussion in 'Technical' started by mixo, Nov 30, 2009.

  1. mixo

    mixo New Member

    Hello.
    I want to run Inotifywait background.
    I use:
    nohup inotifywait -rm --timefmt "%Y %B %d %H:%M" --format "%T =-= %e %w%f" -e create,delete,move /somefile1 >> /somefile2

    then type ctl+Z and bg and it runs background.
    But when I type such a way:
    nohup inotifywait -rm --timefmt "%Y %B %d %H:%M" --format "%T =-= %e %w%f" -e create,delete,move /somefile1 >> /somefile2 &
    and bg, it doesn't work.It moves background and stops,doesn't run.
    How can I run inotifywait background with & symbol?
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Try this:

    Code:
    nohup inotifywait -rm --timefmt "%Y %B %d %H:%M" --format "%T =-= %e %w%f" -e create,delete,move /somefile1 >> /somefile2 &> /dev/null &
     
  3. mixo

    mixo New Member

    thanks falko.

    It sends log to /dev/null.
    So I use:

    Code:
    nohup inotifywait -rm --timefmt "%Y %B %d %H:%M" --format "%T =-= %e %w%f" -e create,delete,move /somefile1 > /dev/null &> /somefile2 &
    

    Can anybody explain why it needs two redirection, ">" ?
     

Share This Page