execute a script on shutdown before the Xserver is terminated

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












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!







share|improve this question




















  • This may help you superuser.com/questions/65460/…
    – Arpit Agarwal
    May 27 at 16:26










  • @ArpitAgarwal: Which part of the post you refer to do you have in mind? I don't see a part that would apply to Ubuntu 16.04. Besides, the answer given in the post says: "The Xserver is not running when the on-logout script is executed, so don't include any programs in the script that try to access the display". So that does not seem to be the right route for me.
    – Wolfhart
    May 28 at 1:28














up vote
0
down vote

favorite












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!







share|improve this question




















  • This may help you superuser.com/questions/65460/…
    – Arpit Agarwal
    May 27 at 16:26










  • @ArpitAgarwal: Which part of the post you refer to do you have in mind? I don't see a part that would apply to Ubuntu 16.04. Besides, the answer given in the post says: "The Xserver is not running when the on-logout script is executed, so don't include any programs in the script that try to access the display". So that does not seem to be the right route for me.
    – Wolfhart
    May 28 at 1:28












up vote
0
down vote

favorite









up vote
0
down vote

favorite











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!







share|improve this question












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!









share|improve this question











share|improve this question




share|improve this question










asked May 27 at 16:18









Wolfhart

83




83











  • This may help you superuser.com/questions/65460/…
    – Arpit Agarwal
    May 27 at 16:26










  • @ArpitAgarwal: Which part of the post you refer to do you have in mind? I don't see a part that would apply to Ubuntu 16.04. Besides, the answer given in the post says: "The Xserver is not running when the on-logout script is executed, so don't include any programs in the script that try to access the display". So that does not seem to be the right route for me.
    – Wolfhart
    May 28 at 1:28
















  • This may help you superuser.com/questions/65460/…
    – Arpit Agarwal
    May 27 at 16:26










  • @ArpitAgarwal: Which part of the post you refer to do you have in mind? I don't see a part that would apply to Ubuntu 16.04. Besides, the answer given in the post says: "The Xserver is not running when the on-logout script is executed, so don't include any programs in the script that try to access the display". So that does not seem to be the right route for me.
    – Wolfhart
    May 28 at 1:28















This may help you superuser.com/questions/65460/…
– Arpit Agarwal
May 27 at 16:26




This may help you superuser.com/questions/65460/…
– Arpit Agarwal
May 27 at 16:26












@ArpitAgarwal: Which part of the post you refer to do you have in mind? I don't see a part that would apply to Ubuntu 16.04. Besides, the answer given in the post says: "The Xserver is not running when the on-logout script is executed, so don't include any programs in the script that try to access the display". So that does not seem to be the right route for me.
– Wolfhart
May 28 at 1:28




@ArpitAgarwal: Which part of the post you refer to do you have in mind? I don't see a part that would apply to Ubuntu 16.04. Besides, the answer given in the post says: "The Xserver is not running when the on-logout script is executed, so don't include any programs in the script that try to access the display". So that does not seem to be the right route for me.
– Wolfhart
May 28 at 1:28















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1040938%2fexecute-a-script-on-shutdown-before-the-xserver-is-terminated%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1040938%2fexecute-a-script-on-shutdown-before-the-xserver-is-terminated%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491