I'm hoping to find (or assign at startup) an identifier code that corresponds to the frontend session that's running. It should behave like
\$SessionID, except that it should be persistent across kernel restarts within the same frontend session, and the same across different kernels attached to the same frontend (but different between concurrently running frontends, say, running different versions of Mathematica). I've thought of extracting the identifier that lives inside of the link object returned as part 1 of
\$FrontEnd, but unfortunately this identifier doesn't have the properties mentioned above (but is there maybe something else I can extract from the link object that does? ...like process start-time or something?). I've been going in circles on this for over a day and the lack of anything simple that accomplishes my goals has become maddening... any thoughts, however fully-developed or otherwise, would be greatly appreciated!
EDIT: I should add that I have tried something like:
SetOptions[\$FrontEndSession, $FrontEndSessionID -> CreateUUID]
but I want this ID to be assigned automatically (not having to evaluate any cells by hand on startup). When I add the line above to my FrontEnd init.m file and save, the file gets overwritten (probably by MMA itself) and removes my added line. If I can avoid init.m getting clobbered, my problem will be solved. Any ideas how to prevent this?