I have an encrypted homedir (ecryptfs) and I'm wanting to run a private mysql daemon with the database files in my homedir. The daemon should be started whenever the homedir is mounted, and stopped before the homedir is unmounted. It seems I have to write an Upstart script, which doesn't seem too hard; the problem is triggering it.
Is there already any Upstart event that is sent on these occasions? Or must I insert an "initctl emit" somewhere? Where? It seems the encrypted homedir is mounted whenever I either open my GUI session or ssh to my account. Is there a common place in these two processes where I might insert code?
(I don't want to patch and compile any C code, just insert maybe a few lines somewere.)