Cleanly close Thunderbird from the command line?
13 posts
• Page 1 of 1
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.)
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. Last edited by Rod Whiteley on June 13th, 2008, 5:19 am, edited 1 time in total.
Rod
Sending the process a SIGHUP works for me (process ID obtained from "lock" symlink), giving the same result as logging out while it is running, and also cleaning up the locks. But then, I'm using the customized RPM's from SuSE, so maybe something works differently in Ubuntu.
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 I tried it on Ubuntu. SIGTERM and SIGHUP both caused settings changes to be lost, although the profile lock was cleared.
Rod
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...
Rod Whiteley, I think to have found a "quit" routine working.
Could you tell me which settings exactly are lost if you kill Thunderbird from the command line with SIGHUP or SIGTERM? 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 Rod
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. 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
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 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. ![]() Locking due to very old age.
Ancient Amateur Astronomer
Win-7-HP/IntelĀ® DualCore-2.0GHz/500G HDD/4 Gig Ram/550Watt PSU/350WattUPS/Firefox-20.0-62.0-70.0/T-bird-2.0.0.24/SnagIt-v10.0.1/MWP-7.12. (Always choose the "Custom" Install.)
13 posts
• Page 1 of 1
Return to Thunderbird Features Who is onlineUsers browsing this forum: No registered users and 1 guest |
![]() |