Re: [dev] New utility "when"

From: Calvin Morrison <mutantturkey_AT_gmail.com>
Date: Wed, 11 Dec 2013 16:23:01 -0500

I'm confused how this is different than the usual

longrunningscript.sh && generic_notify_command

Could you clarify?

On 11 December 2013 11:31, Andrew Gwozdziewycz <web_AT_apgwoz.com> wrote:
> Hey all,
>
> If you've used watch(1) you know that running a command repeatedly is
> useful. What I wished for yesterday though, is for a mechanism that
> notified me when a command succeeded, but is long running -- say an
> ssh session.
>
> I wondered if I could do it in shell, but figured it might be too
> tricky to do concisely, so I wrote a C program that combines SIGALRM
> and SIGCHLD into something that works fairly well (though, I've only
> tested it on OS X so far, yeah, I know), but probably murders POSIX
> standards (I haven't written Unix C in a while, so my Stevens books
> are rusty)
>
> Anyway, source is on github: https://github.com/apgwoz/when
>
> Example usage:
>
> when "make" "xmessage 'that long running build actually worked'"
>
> (This is no different than a simple while ! `make` ... of course)
>
> But, using -t is where the "magic" happens. Lets say you're waiting
> for a host to come up on AWS or something:
>
> when -t "ssh user_AT_host" "xmessage 'Connected'"
>
> When the ssh command finally succeeds, xmessage will pop up saying
> 'Connected' and the prompt will still be there.
>
> Maybe one of you will stop laughing long enough to find it useful.
>
> Cheers!
>
> Andrew
>
>
> --
> http://apgwoz.com
>
Received on Wed Dec 11 2013 - 22:23:01 CET

This archive was generated by hypermail 2.3.0 : Wed Dec 11 2013 - 22:24:06 CET