I have a process P which writes contents to a file F. I need to be able to dynamically enable/disable P to write to F. I tried changing the permissions for the user/group but this requires the process to be restarted(in fact the whole system). In the end I should be able to execute a "script" which does the following:
EnablePWriteF sleep 10 DisablePWriteF
and as a result P will be able to write for the first 10 seconds and not after that. I am using Debian distibution.
Is this possible?
Update: The real use case is that I am trying to filter a given process to write to a specific device file /dev/fb0 I have two processes which are writing to that file and I want to be able to determine exactly one of the two which is allowed to write to that file at a given moment without having to kill/stop the processes.