Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running a long process on a remote shell. I would like to trigger a notification when the process is complete. This answer does not suffice, because the long command is on a remote server, so it cannot call terminal-notifier.

I can get close to my desired outcome by using an iTerm2 trigger. For example if I run the following on the remote server and set up an iTerm2 trigger for __FINISHED__:

./long_process && echo "\__FINISHED__"

This has the undesirable feature that every time I scroll back to this command in my editor or my code (I'm running code in an emacs shell), the notification triggers.

One solution might be some kind of text notification that iTerm2 will recognize, but that will not appear in an emacs scrollback buffer.

share|improve this question
    
echo "__FIN""ISHED__" –  grawity Sep 13 '13 at 22:20
    
Halfway there - it prevents notifications when i scroll through my code, but doesn't prevent undesirable notifications if i scroll through my output window. –  pnj Sep 16 '13 at 13:53

1 Answer 1

up vote 3 down vote accepted

You have not specified what kind of notification you want nor what OS the remote server is running so I am going to have to make some assumptions here. I will assume you don't really care what type of notification it is as long as you are notified and that the remote server is running some flavor of *nix.

  1. Send yourself an email. If sendmail is configured on the server, you could do

    ./long_process && echo "Job done" | sendmail pnj@yourdomain.com
    
  2. ssh back to your local machine (assuming this is possible) and make it talk to you. See here for more cool ways of making OSX beep at you.

    ./long_process && ssh you@local.ip say "Yo! All done"
    

    or

    ./long_process && ssh you@local.ip terminal-notifier -message "Job finished!" -title "Info"
    

    If you are connecting from a dynamic IP and you have configured your router so that you can ssh to that dynamic IP, you can do this (assuming you are only currently connected from your remote machine):

    ip=$(who | grep $USER | perl -lne 's/\\((.+?)\\)\s*$//; print "$1"' | tail -n 1) &&
     ./long_process && ssh you@$ip terminal-notifier -message "Job finished!" -title "Info"
    

    You can set up password-less ssh in the normal way. It should not be affected by the dynamic IP. Once you have done so, the code above will work.

  3. Use pushover and send a notification to your Android or iOS device (if you have one)

    ./long_process && pushover.pl "All done"
    
share|improve this answer
    
Using say over SSH is really nice on Macs. –  slhck Sep 13 '13 at 20:37
    
@slhck heh, yeah I'd read that one :). –  terdon Sep 13 '13 at 20:38
    
#2 is the concept i'm looking for, but the local machine is a laptop and has a dynamic IP address. Ideally I want something like terminal-notifier, i.e. a small, silent popup window. Even if the remote shell knows the spawning process, I'm not sure how ssh would work without entering my password each time, given the dynamic IP. –  pnj Sep 16 '13 at 14:00
    
@pnj see updated answer. –  terdon Sep 16 '13 at 14:32
    
@terdon that does it, after fixing the backslashes in the perl expression that superuser ate up. –  pnj Sep 16 '13 at 18:38

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.