Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I make sure I get notified when the job is done?

Here is what I'm running:

$ time find -exec chmod o-r '{}' \+&

I would like to know how long the job took and be notified when it is done.

I thought of doing this:

$ time ls -l 2>&1 | write buttlebutkus pts/0&

(Using ls -l to do a quick test)

But the result was kind of weird. Though it did seem to essentially work, but I'm afraid maybe only because the ls sent an EOF to the write.

EDIT:

I just tried this:

$ time find -exec chmod o-r '{}' \+ 2>&1 | write buttlebutkus pts/0&

Now I am seeing millions of pages of output and cannot get away from it with either ctrl-z or ctrl-c.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted
$ time find -exec chmod o-r '{}' \+ 2>&1 && write buttlebutkus pts/0 &

man bash

   The control operators && and ││ denote AND lists and OR lists, respectively.  An AND list has the form

          command1 && command2

   command2 is executed if, and only if, command1 returns an exit status of zero.
share|improve this answer
    
Brilliant! I was going to ask you why &&. Thank you for adding the quote from man bash. I would have never thought of using that operator. Perfect! –  Buttle Butkus Sep 26 '12 at 5:12
    
By the way, am I interpreting the 2>&1 correctly? Do I even need that for this to work? If you have any link that helps explain that syntax I would appreciate that too. –  Buttle Butkus Sep 26 '12 at 5:14
    
2>&1 means that redirect stderr to stdout, and display both on the terminal. –  quanta Sep 26 '12 at 5:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.