Monday 2011-03-21

Unix sleep should look more like this:

int main(int argc, char **argv) {
        char s[1024];

        while ( read(0,s,1000) )
        return 0;

Cause then we could easily control programs that don't terminate. e.g.:

tcpdump -n -i eth1 | sleep 30 | ./

As it stands, I have to find the PID of the tcpdump, sleep the remaining time, and then kill the PID.

I usually just use bash's job control for that kind of thing: tcpdump -n -i eth1 > ./ & sleep 30 && kill %1 -Doug

yeah, that's also useful for killing off programs that should have finished by a certain time, like: ps fax > /tmp/logs.$(date | sed -e 's/ /-/g') & sleep 30 && kill %1 I secretly wanted sleep(1) to just work, though. ;)