I asked this questions on Ubuntu Forums a couple of months ago but did not find a solution there, so I ask it again here.
I am using Ubuntu 16.04. I am trying to solve the problem that Chromium tells me on every startup that it "didn't shut down correctly". There is a long thread about this issue on Ubuntu Forums. But the solution proposed there, which is to put the command
kill -TERM $(pgrep chromium)
in the script /sbin/shutdown
does not work in my case. Another proposed solution, namely to put the said command in a script in /etc/rc0.d
does not work either. I also tried in the meantime (i.e., after posting on Ubuntu Forums) to put the line
session-cleanup-script=/link/to/script_with_kill_Chromium_command
in /etc/lightdm/lightdm.conf
(which is the solution proposed in this Ask Ubuntu post), but that does not work either.
I guess that the reason why these proposed solutions don't work is that the command needs to be executed before the Xserver is terminated (given that Chromium is killed when the Xserver is terminated), but in the proposed solutions it is executed afterwards. The command in itself appears to work: When I execute it manually and then shutdown and restart, Chromium does not produce the "didn't shut down correctly" message. So my question is this: Is there a way to execute a command/script on shutdown before the Xserver is terminated?
Thanks in advance for your help!