Cleanly close Thunderbird from the command line?
-
- Posts: 5
- Joined: January 8th, 2006, 7:26 pm
Cleanly close Thunderbird from the command line?
I often run thunderbird over ssh, remotely logging into my Ubuntu 7.10 PC. Sometimes, I'll have left Thunderbird running, and will either have to kill Thunderbird (and clean up the locks) , or just wait till I get back home. Is there a way to cleanly close all instances of Thunderbird currently running? Would a script that killed Thunderbird and removed the locks essentially do the same thing? I'm a little worried that there might be something else that isn't cleaned up properly (and of course there's always the worry Thunderbird is doing something when I kill it.)
- Rod Whiteley
- Posts: 11480
- Joined: December 6th, 2004, 3:41 am
- Location: UK
If you simply kill it, then Thunderbird does not write some things back to disk. For example, you could lose some settings changes. But there does not seem to be a way to close it cleanly from a command line.
As an experiment, I added support for a command line -quit switch in my Mail Tweak extension. I have no idea whether it will work in your situation.
As an experiment, I added support for a command line -quit switch in my Mail Tweak extension. I have no idea whether it will work in your situation.
Last edited by Rod Whiteley on June 13th, 2008, 5:19 am, edited 1 time in total.
Rod
-
- Moderator
- Posts: 14404
- Joined: May 3rd, 2007, 7:40 am
- Location: US
-
- Posts: 855
- Joined: May 3rd, 2004, 1:20 pm
- Contact:
By default "kill" command should send a "SIGTERM" signal, so the process should be terminated cleanly.
See "man kill" and "man signal" and http://en.wikipedia.org/wiki/SIGTERM
See "man kill" and "man signal" and http://en.wikipedia.org/wiki/SIGTERM
- Rod Whiteley
- Posts: 11480
- Joined: December 6th, 2004, 3:41 am
- Location: UK
-
- Moderator
- Posts: 14404
- Joined: May 3rd, 2007, 7:40 am
- Location: US
You are right, it's not updating prefs.js and some other files in the profile when closed this way. This appears to be a known issue, I found a fairly old enhancement request to be able to close Mozilla from the command line and about not updating things correctly if shut down by a signal. I would consider it rather a bug though if SIGTERM and SIGHUP are not honored in the way they should, like shutting down the application similar to normally closing it...
-
- Posts: 855
- Joined: May 3rd, 2004, 1:20 pm
- Contact:
- Rod Whiteley
- Posts: 11480
- Joined: December 6th, 2004, 3:41 am
- Location: UK
I did not investigate fully. I think normally Thunderbird may write localstore.rdf when a window closes, and prefs.js when the application closes, but there might be others—for example, I do not know when add-ons change requests are written so that they can be completed on the next restart.
Mail Tweak looks for a window containing goQuitApplication, and calls it, but it might not always succeed:
http://lxr.mozilla.org/seamonkey/source ... rlay.js#49
Mail Tweak looks for a window containing goQuitApplication, and calls it, but it might not always succeed:
http://lxr.mozilla.org/seamonkey/source ... rlay.js#49
Rod
-
- Posts: 855
- Joined: May 3rd, 2004, 1:20 pm
- Contact:
Hello again Rod.
Which version of Mail Tweak has this option? If it has not been released yet, could I try it?
In my test, I've tried to use "goQuitApplication" function, but I always had "zombie" processes (on Windows, no test yet on Linux). Maybe your method has fixed this problem.
It seems to work better enumerate open windows and close them with "close()" method called with setTimeout, but I must investigate more about it.
Which version of Mail Tweak has this option? If it has not been released yet, could I try it?
In my test, I've tried to use "goQuitApplication" function, but I always had "zombie" processes (on Windows, no test yet on Linux). Maybe your method has fixed this problem.
It seems to work better enumerate open windows and close them with "close()" method called with setTimeout, but I must investigate more about it.
- Rod Whiteley
- Posts: 11480
- Joined: December 6th, 2004, 3:41 am
- Location: UK
I sent you a private message. I did not try to fix any problems in goQuitApplication. Enumerating windows and closing them is exactly what it does: http://lxr.mozilla.org/seamonkey/source ... up.cpp#258
Rod
-
- Posts: 855
- Joined: May 3rd, 2004, 1:20 pm
- Contact:
I tried your test version, but in Linux I get this error:
Instead with this code, it seems to work on Linux and gives no "zombie" process on win:
With this code, the shutdown seems to be clean.
But it should be more tested...
Ciao, Paolo
Code: Select all
The program 'thunderbird-bin' received an X Window System error.
Instead with this code, it seems to work on Linux and gives no "zombie" process on win:
Code: Select all
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].
getService(Components.interfaces.nsIWindowWatcher);
var enum = ww.getWindowEnumerator();
while (enum.hasMoreElements()) {
var w = enum.getNext()
w.setTimeout("window.close()", 2000);
}
With this code, the shutdown seems to be clean.
But it should be more tested...
Ciao, Paolo
-
- New Member
- Posts: 1
- Joined: December 23rd, 2017, 9:35 pm
Re: Cleanly close Thunderbird from the command line?
to All,
I currently use these commands to do that successfully from ssh command line:
1. DISPLAY=:0.0 xdotool search --onlyvisible --name thunderbird # it show me the window id
2. DISPLAY=:0.0 wmctrl -ic window_id
I not really sure if the command it can work reliably.
I currently use these commands to do that successfully from ssh command line:
1. DISPLAY=:0.0 xdotool search --onlyvisible --name thunderbird # it show me the window id
2. DISPLAY=:0.0 wmctrl -ic window_id
I not really sure if the command it can work reliably.
- LIMPET235
- Moderator
- Posts: 39954
- Joined: October 19th, 2007, 1:53 am
- Location: The South Coast of N.S.W. Oz.
Re: Cleanly close Thunderbird from the command line?
Locking due to very old age.
[Ancient Amateur Astronomer.]
Win-10-H/64 bit/500G SSD/16 Gig Ram/450Watt PSU/350WattUPS/Firefox-115.0.2/T-bird-115.3.2./SnagIt-v10.0.1/MWP-7.12.125.
(Always choose the "Custom" Install.)
Win-10-H/64 bit/500G SSD/16 Gig Ram/450Watt PSU/350WattUPS/Firefox-115.0.2/T-bird-115.3.2./SnagIt-v10.0.1/MWP-7.12.125.
(Always choose the "Custom" Install.)