3 of 4 Improved formatting.

Create a fake read only device like file with incrond

I need to generate UUID with uuidgen (not through any function call, but external command, because processes which will read the file cannot call any APIs or external commands directly).

My idea is to create an incron job which regenerates content of file on read (IN_ACCESS operation). So that whenever the file, monitored by incrond is read, a script overwrites its content with new UUID:

/usr/bin/uuidgen > file_to_be_monitored_and_read

My questions:

  • Is there another way to create such a device like file?
  • What problems can arise if multiple processes try to read from the file in about the same time? Will incrond and script be able to regenerate the content quickly enough?