Unix sleep should look more like this:
int main(int argc, char **argv) {
char s[1024];
alarm(atoi(argv[1]));
while ( read(0,s,1000) )
write(1,s,1000);
return 0;
}
Cause then we could easily control programs that don't terminate. e.g.:
tcpdump -n -i eth1 | sleep 30 | ./pcap_netflow.pl
As it stands, I have to find the PID of the tcpdump, sleep the remaining time, and then kill the PID.