Mail will not lock because of running process

Started by mrwhizkid, June 10, 2015, 09:48:40 AM

Previous topic - Next topic

mrwhizkid

Hi everyone,

I love this program and I set up the mail encryption according to the video but whenever I try to lock the mail folder, I always get this error:

The folder 'Mail' could not be locked because it is being used by: com.apple.internetaccounts

Of course, I can go in and close this process manually and the mail folder will lock but that is quite inconvient.

I also tried to see if I could write an Applescript to close this process after closing mail automatically but no so such luck.

This is a deal breaker for me and I am thinking about returning the software. I'm hoping someone could help!

Thanks.

zsolt

Hello, the disk image we are using to protect data with espionage, is mounted on the system like any other volume, be that an external physical disk, or a logical volume like disk image.
If there is an open file on the volume, the OS will not allow ejecting it, i.e unmounting it, because that would break the connection between the open file and the process which is using it, so normally you get a "disk busy" message.

If Apple decided to leave some background processes active which continue to read from Mail related files even if Mail is terminated, there is little we can do about it. We can merely find which process it is, and which file it is, but they it is you who has to decide if you want to manually terminate the process and whether that bares the possibility of ending up with corrupted data.

with the lsof command in terminal, you can get a list of all open files on the system, combining it with the path and grep to filter out, you can get a list of files which are on the mounted volume.

with command mount, you can get the list of mounted volumes with their path, here you should identify the path of the volume which belongs to the protected folder.

and then the command would go like this

lsof | grep hereyoupastethepath

give it a try and see if that reveals which file is kept open.

Rgds
Zsolt
Follow @espionageapp on twitter for news! | For general Mac support, please visit Mac Me Support

mrwhizkid

Hi zsolt,

Thanks for your reply.

It's not a file that is open but rather a process.

It is called com.apple.internetaccounts which is actually the name of a folder in Libraries. When I manually kill that process through Activity Monitor, I am able to successfully lock the mail folder. But it's a pain having to do that every time.

For whatever reason, this process continues to run even after the Mail App has been closed. I've looked all over for a solution to this but no one seems to be talking about it on the internet.

Terminating this process after the app has been closed has no ill effects on the mail app. Is there anyway to set it so that Espionage can override the process and force quit the app?

zsolt

It is not a process, but a file :-)

The process is keeping the file open and the file is keeping the disk image from unmounting. The fact that the folder is named the same as the process is just a coincidence.
But yes, we have to take care of the process and that will release the file.
There is no way we can force anything from Espionage, we are just a small helpless application against mighty OS X :-)

But, we do have folder actions which you can use to run pre/post processing for each folder you unlock/lock.
Using this you can launch an application or script. So I guess what you should do is either write an applescript or a terminal shell which will find out the process PID (you can find this by grepping out the process name from the process list you can get with ps -ef or ps -ax command) and then using kill to terminate the process before the folder lock attempt. To get to the folder options, click onto small "i" near the folder name in the main Espionage folder list.

Give it a try and if you get stuck, let me know.

Rgds
Zsolt
Follow @espionageapp on twitter for news! | For general Mac support, please visit Mac Me Support

mrwhizkid

Thanks! I think you pointed me in the right direction. But I am confused by something you wrote:

"But, we do have folder actions which you can use to run pre/post processing for each folder you unlock/lock.
Using this you can launch an application or script."

Here is the script I wrote which I have tested and works well to kill the process:

tell application "System Events"
if (application process "com.apple.internetaccounts" exists) then
   do shell script "killall com.apple.internetaccounts "
end if
end tell

But I don't see an option to open this script in Folder Action on a Lock action. I see where it could be opened on an unlock action but I need the script to run on the lock action.


zsolt

Hello, near the folder name in the Espionage main window there is a small "i" symbol, click on it, that will take you to the folder options window. There you will see a "folder actions" button, click on it, the upper part of the window is for unlock actions, these will happen AFTER you unlock the folder, so for example you can launch an application automatically when you unlock the folder, the lower part are the lock actions, these will happen BEFORE the folder locks, this is for example to quit an application before the folder is locked, here you can add you script together with quitting Mail, so first set Mail to quit, then set your script to run and once both these actions complete, Espionage will try to lock the folder.

This should work, please try it and let me know.

Rgds
Zsolt
Follow @espionageapp on twitter for news! | For general Mac support, please visit Mac Me Support

mrwhizkid

Hi again,

Please take a look at the screenshot. I already set up folder actions as detailed in your video. What I need to know is how to add a script to the lock part because as you can see there are only two options: Quit App and Lock Folder.

I don't see any option to run a script there.

zsolt

And indeed you are right  ???
For some reason I was convinced that it is launch-launch, i.e. open-open, in spite of that not making sense at all.
OK, so yes, for locking we have only quit action. I already submitted this on a todo list, so I guess we will be adding this feature in upcoming versions.
In the mean time, all I can come up with is to try to catch a quit request inside the applescript.
So basically you should launch the script when the folder unlocks and let it loop waiting for quit request which you send when locking the folder, then the script catches this request, kills the com.apple.internetaccounts and then quits itself.
If this cannot be done within one script, then maybe you can use two scripts, where the second will be launched by the first one, once the second quits, the parent gets a return code and then kills the com.apple.internetaccounts and quits itself.
I know it is not the nicest solution, but maybe it even sounds fun managing to make this work in apple script :-)

For the time being I cannot offer you anything better.
If you still wish a refund, there should be no problem, just let me know.

Rgds
Zsolt
Follow @espionageapp on twitter for news! | For general Mac support, please visit Mac Me Support

mrwhizkid

Hi again,

Thanks for the advice. I will work on it and see what I can come up with. It's a good program and I purchased the lifetime upgrade package so I am willing to wait until that feature comes out sometime in the future. For my line of work, it is worth the extra inconvenience to have to manually close that process when I close out the email.

Thanks!