[Gllug] Delayed data feed

Neil J. Macvicar neilm at kernelspace.co.uk
Wed Jan 12 22:50:51 UTC 2011

As was mentioned before, it's not so trivial a task.

I'd approach it as follows :-

1. Create a FIFO, e.g mkfifo foo. (Note that if the fifo is not opened for reading, it will send a SIGPIPE to the writing process, causing it to block - see man(7) fifo).

2. Run a shell script that does the following :-

cat < foo >> delivery.txt

3. Note the PID of the shell script.

4. Run another shell script
while true ; do
sleep 30
kill -SIGSTOP <pid>
echo delivery.txt
echo "" > delivery.txt
kill -SIGCONT <pid>

This process could probably be optimised somewhat, but it ought to suffice.


----- Original Message ----- 
From: "- Tethys" <tethys at gmail.com> 
To: "Greater London Linux User Group" <gllug at gllug.org.uk> 
Sent: Wednesday, 12 January, 2011 4:33:02 PM 
Subject: [Gllug] Delayed data feed 

Does anyone know of a simple delay utility that consumes data from 
stdin and outputs it on stdout a fixed time later? What I want to be 
able to do is: 

mkdata | delay 30 | send_data_to_customer 

That will send the (time sensitive) output of mkdata to the customer 
with a 30 second delay. The amount of data I'm talking about isn't so 
large that I need to worry about memory usage, and buffering it in RAM 
will work just fine. I can write it myself, but I'd rather not 
reinvent the wheel if someone's already done it. 


"Any sufficiently advanced financial instrument is indistinguishable from fraud" 
Gllug mailing list - Gllug at gllug.org.uk 
Gllug mailing list  -  Gllug at gllug.org.uk

More information about the GLLUG mailing list