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?
  • I think you can use incrond to do something when a file is opened for reading, but us "IN_ACCESS,IN_NO_LOOP" so that it's not called from within itself. I've experimented with using incron to update a file when it's opened for reading, and found that it reads the last version of the file generated. – Rob Nov 25 '14 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.