• Stars
    star
    130
  • Rank 277,575 (Top 6 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created almost 11 years ago
  • Updated about 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

run a command until a condition is met, then run another one!
WHEN(1)

NAME
       when - repeatedly runs a command, then another when the first succeeds

SYNOPSIS
       when [-n <seconds>] [-t|-z] [-h] [-v] <conditional> <command>

DESCRIPTION
       when  runs conditional every N seconds awaiting for "success." Success
       is defined in one of two ways. In timebomb mode, -t, success is
       defined by whether or not the conditional is still running after N
       seconds (as specified by the -n flag). In zero mode, -z, success is
       achieved when conditional exits with a return value of 0.

       The -n flag allows the interval to be set (in seconds) between
       successive attempts at running the conditional

       when will run until interrupted, or command completes.


OPTIONS
       -h     Prints the help message and exits successfully.

       -n seconds
              Sets the interval for running the conditional to seconds
              In timebomb mode, the specified time in seconds will need to pass 
              before the conditional succeeds.

       -t     Sets the success mode to timebomb which succeeds after
              conditional has been running for at least seconds

       -v     Prints the version and exits successfully.

       -V     Turns on verbose output. Mostly useful for debugging purposes.

       -z     Sets the success mode to zero which succeeds after conditional
              returns 0 the first time. The conditional is guaranteed to be run
              at most 1 time every seconds

NOTE
       Note that both conditional and command are given to "sh -c" which
       means that you may need to use extra quoting to get the desired effect.

       Note that POSIX option processing is used (i.e., option processing
       stops at the first non-option argument).  This means that flags
       after conditional don't get interpreted by when itself.

EXIT STATUS
       when makes an effort to exit with the exit status returned by the
       conditional in timebomb mode. In zero mode the exit status should be,
       well, 0.

EXAMPLES
       TODO more examples needed

       Suppose you have a failing build, xmessage will alert you when
       it succeeds.

              when "make" "xmessage 'hurrah, build passed'"

       Or you want to say hello to john when he logs on

              when "w | grep john" "echo 'hello, john' | write john"

       Or maybe you have a daemon failing in a tight loop due to
       misconfiguration or lack of resources. One can run it with when and
       be alerted to when it becomes happy

              when -n 10 -t "<failing daemon>" "xmessage 'daemon running'"

SEE ALSO
       watch(1)

COPYRIGHT
       Copyright (C) 2013 Andrew Gwozdziewycz

       This program is free software: you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
       by the Free Software Foundation, either version 3 of the License,
       or (at  your option) any later version.

       This  program  is  distributed  in  the  hope that it will be useful,
       but WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       General Public License for more details.

       You should have received a copy of the GNU General Public License
       along with this program.  If not, see <http://www.gnu.org/licenses/>

AUTHOR
       when was written by Andrew Gwozdziewycz <[email protected]> in 2013



                                                                                                         2013
                                                                                                         Dec
                                                                                                         10
                                                                                                         WHEN(1)

More Repositories

1

wipes

Pipe text to a WebSocket server
JavaScript
252
star
2

nyanbar

Nyan Cat progress bar!
Python
54
star
3

django-favorites

Generic favorites app for django with some more utilities that make it a bit more plugable
Python
33
star
4

grapt

simple charting tools for unix.
C
28
star
5

slideshow-simple

Easier slideshows using Racket's slideshow tool
Racket
22
star
6

mvn-el

helpers for working with maven via emacs (derives from ant-el)
Emacs Lisp
16
star
7

app-script-game-of-life

Game of Life for Google Spreadsheets
JavaScript
13
star
8

emacs-config

My emacs config
Emacs Lisp
13
star
9

heroku-buildpack-tor

Run a tor hidden service on Heroku
Shell
11
star
10

patter

`go test -v` transformer to provide TAP output
Go
11
star
11

musniper

Snipe RSVPs on popular Meetup groups
Python
10
star
12

timer

Lightning talk timer
JavaScript
10
star
13

heproxy

An HTTPS Everywhere proxy for plugin incompatible browsers, and everywhere else.
Go
8
star
14

ant-el

Helpers for using ant with emacs
Emacs Lisp
8
star
15

unipoint

emacs minor mode for quickly entering mathematics related unicode codepoints
Emacs Lisp
7
star
16

chatter

chatter bot framework inspired by eliza for Guile
Scheme
6
star
17

envjson

Runs a program in a modified environment, specified via JSON.
Go
6
star
18

tech-blogs-you-should-read

This is ultimately an OPML file of tech blogs you should read. Ever changing (hopefully)!
Python
6
star
19

recat

Replay log files in simulated real-time
Python
6
star
20

more-modest

Makefile powered blog
CSS
6
star
21

phizer

dynamic photo resizing proxy
Python
5
star
22

cfdg

A language, inspired by CFDG, using Racket
Racket
5
star
23

muxtube

like the original muxtape, only with youtube videos
Python
5
star
24

thumb-through

quickly read an article from emacs
Emacs Lisp
5
star
25

scanabanana

It's peanut butter jelly time.
Racket
4
star
26

hisp

a simple lisp interpreter written in Haskell
Haskell
4
star
27

bitdb

a stupidly hacky key value store on top of bit.ly
Python
4
star
28

softserv

clojure lib inspired by contrib/socket-server for making thread pooled servers
Clojure
4
star
29

catchgold

ncurses based tax evasion game
C
4
star
30

hack-and-tell-web

hackandtell.org
4
star
31

activator-el

init for emacs
Emacs Lisp
4
star
32

casemaker

helps you create simple test cases
Python
3
star
33

abstractina

implementations of abstract machines in python
Python
3
star
34

envbreach

Fill your environment with Vault secrets
Go
3
star
35

bangbangcon

!!Con talk and supporting things.
C
3
star
36

nyar

command line progress bar
C
3
star
37

turbobtn

It's like the early 90s again, but for modern Linux machines.
Tcl
3
star
38

old-sigusr2.net

my blog
CSS
2
star
39

sigusr2.net

My blog! http://sigusr2.net
Shell
2
star
40

apg.github.com

github page!
2
star
41

qryp

It's just like grep, but with query capabilities. See also apg/lack (In progress, or lack there of)
C
2
star
42

denote

demise ate the cheese.
2
star
43

text-please

Text Please!
Python
2
star
44

bf

A brainfuck interpreter (and studio)
C
2
star
45

fn-php

functional primitives for php 5.3+
PHP
2
star
46

angmines

Minesweeper using angular.js
JavaScript
2
star
47

ubergator

occupy internet data for redistribution aggregator
Python
2
star
48

astheygrow

you'll see
2
star
49

lein-envclasspath

add $CLASSPATH to lein's classpath (yes, this shouldn't be necessary)
Clojure
2
star
50

python-worlds

A hack attempt at building Alessandro Warth's Worlds in Python
Python
2
star
51

tweetmap

character map for twitter as a chrome extension
JavaScript
2
star
52

asteroidfight

asteroids deathmatch
Clojure
2
star
53

samegame

samegame in clojure
Clojure
2
star
54

ln

The Natural Logger for Go
Go
2
star
55

quickpass

quick password manager
Shell
2
star
56

surd

an absurd lisp interpreter
C
1
star
57

anglife

Life in Angular JS
JavaScript
1
star
58

chibi-apg-unveil

unveil(2), from OpenBSD, in Chibi Scheme!
C
1
star
59

turnon

stupid typing visualization
1
star
60

lack

yet another yak shave
Go
1
star
61

nibl

a tiny graphics engine
C
1
star
62

jubil

The jubil programming language
C
1
star
63

apgwoz.com

HTML
1
star
64

bucket

Implementations of Leaky and Token bucket for Go.
Go
1
star
65

stationary

Another stupid static site generator. I swear it'll be useful.
Python
1
star
66

dwm

my fork of dwm with patches applied, etc.
C
1
star
67

slashreading.org

a public repo for
HTML
1
star
68

hidden-polls

Simple polling app that can run with the tor-hidden-service buildpack!
Go
1
star
69

fifh

yet another forth interpreter +1 me too!
1
star
70

racket-con-2017

slideshow/simple source for my Racket Con 2017 presentation.
Racket
1
star
71

clj-docup

A simple document markup without the gobbledegook
Clojure
1
star
72

lc

musings with fnparse by implementing a simple untyped lambda calculus reducer
Clojure
1
star
73

dregex

implementation of derivative regular expression matcher
Clojure
1
star
74

dotfiles

config files and such
Shell
1
star
75

logflect

logplex tails as a service via drains.
Go
1
star
76

websheet

bookmarklet to make any table on the web a spreadsheet
JavaScript
1
star
77

lpxgen

Logplex test generator
Go
1
star
78

life

game of life in clojure
Clojure
1
star
79

keyfavors

A simple way to sign a bunch of keys
Shell
1
star
80

sokoduino

Sokoban for arduino.
C
1
star
81

emacs-connect

Connect to an emacs server, or just fucking start one.
Shell
1
star
82

hassle

A Lisp powered game framework, that's almost certainly too much of a hassle to actually use
C
1
star
83

canoe

Create a canoe out of log files and chisels, and send them down some routes!
Python
1
star
84

basin

the start of a generic heroku HTTPS drains framework...
Go
1
star
85

flenv

Go flag + envdecode
Go
1
star
86

muprsvps

visualization of streaming api RSVPs on meetup.com
Clojure
1
star
87

require

for when you require a module in python and there are weird circumstances around the environment
Python
1
star