in reply to Reading from a UNIX daemon

Actually I just want to accomplish something very simple. The background program samples values every 15 seconds. Takes the difference between two most recent samples and returns a value call it X. Thus, the value X is refreshed every 15 seconds.

Then, when another program is activated with certain command line arguments, it is supposed to immediately take the current value of X and print it.

I got it implemented already by making the background program write X to a file and later getting the second program to read from the file.

But I was thinking of modifying it so that I wouldn't need to use a file since a file may be externally altered. I was thinking of using packages or modules but somehow the 'use' function didn't go quite well.