Matlab Automation - Check if pdf is open and by which user.
Mostra commenti meno recenti
Hello,
I'm currently running a code that produces .pdf files into a server folder. These files are used by many users (50+) and overwritten daily to reflect the most recent data available.
Sometimes, users forget to close the files when leaving and it prevents the file from being overwritten by the automation. Is there a way to check if the [filename '.pdf'] is in use and by which user (similar to the MS Office Read Only and Notify feature)?
6 Commenti
Walter Roberson
il 1 Giu 2011
Which OS is/are involved? Which networked file system?
Richard
il 3 Giu 2011
Jason Ross
il 3 Giu 2011
I assume the machine doing the file serving is Windows, as well? If so, I suggest moving to a setup where most clients connect via a read-only share (e.g. \\servername\data), and you update the file via a second share to the same location where you have read/write permission (e.g. \\servername\rwdata). On the (assumed) Windows server there are tools in Server Manager (Share and Storage Management) to see who has open sessons and files and disconnect them if need be. But these tools require admin permission on the server, which you may not be able to get -- and the approach I outline below will be more scalable and sustainable for the number of users you have accessing the data.
Jason Ross
il 3 Giu 2011
As an added note, you can also use groups to set up who can read and write to the share if you want to approach it that way, as well. The main idea is that you make Read the way most people connect and Read-Write a special case when you need to update the data.
Richard
il 10 Giu 2011
Jason Ross
il 10 Giu 2011
In order for this to work, you will need some administrative control on the second server. The scheme where you have server2 put the files on server1 would accomplish this goal. The key is that you want to force most clients to get this read-only.
As for the permissions "expiring", once the file is opened by someone RW, you still have to be able to kick them off.
The simplest implementation of this is a batch file that does this (on server2 -- so you would need to work out something with the admin of this server)
net share /delete <sharename>
copy \\server1\mydoc.pdf <path_that_is_shared>
net share myshare <path_that_is_shared> /GRANT:user,READ
this would be run via scheduled task.
Alternatively, you could look into using the http protocol and forgetting the whole share thing. I think it's possible to present server1's directory on server2. Then the web server takes care of presenting the files and you won't have to worry about file locks.
Risposta accettata
Categorie
Scopri di più su Server Management in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!