Re: [dev] New utility "when"

From: Calvin Morrison <mutantturkey_AT_gmail.com>
Date: Thu, 12 Dec 2013 11:48:08 -0500

consider submitting when to the moreutils package

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 Thu Dec 12 2013 - 17:48:08 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 12 2013 - 18:00:08 CET