execute a script on shutdown before the Xserver is terminated
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
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!
shutdown chromium
add a comment |Â
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!
shutdown chromium
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
add a comment |Â
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!
shutdown chromium
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!
shutdown chromium
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
add a comment |Â
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
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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