We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Automated Backup of TB Database using Task Scheduler

more options

I'm trying to set up an automated backup of my Thunderbird database using my chosen backup program Beyond Compare. With that in mind, I've created a small batch file that shuts down Thunderbird, runs the backup application to create the snapshot, and then starts up Thunderbird again.

If I just run this batch job from a command prompt, it works perfectly. The batch shuts down TB, I get my backup data copy, and then the batch restarts TB.

I can run this batch job multiple times and it succeeds every time and works perfectly.

Now I just invoke the batch job from Windows 10's Task Scheduler and things go south. The TB shutdown and backup go fine, and the batch job starts up TB. TB appears in the task scheduler window, but I never get the window, and I have to open Task Manager and kill the copy of TB and manually start it to get the desktop window back.

Can anyone tell me what is happening and how to make this automation work?

Contents of the batch file in question

'@echo off for /l %%x in (1, 1, 10) do (

 rem echo Loop iteration count %%x
 taskkill /im thunderbird.exe

) taskkill /f /im thunderbird.exe timeout 10 start "" "C:\Program Files\Beyond Compare 4\BCompare.exe" "@D:\BC_Sync\Thunderbird Snapshot to H.txt" /wait timeout 10 start "" "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe" '

I'm trying to set up an automated backup of my Thunderbird database using my chosen backup program Beyond Compare. With that in mind, I've created a small batch file that shuts down Thunderbird, runs the backup application to create the snapshot, and then starts up Thunderbird again. If I just run this batch job from a command prompt, it works perfectly. The batch shuts down TB, I get my backup data copy, and then the batch restarts TB. I can run this batch job multiple times and it succeeds every time and works perfectly. Now I just invoke the batch job from Windows 10's Task Scheduler and things go south. The TB shutdown and backup go fine, and the batch job starts up TB. TB appears in the task scheduler window, but I never get the window, and I have to open Task Manager and kill the copy of TB and manually start it to get the desktop window back. Can anyone tell me what is happening and how to make this automation work? Contents of the batch file in question '@echo off for /l %%x in (1, 1, 10) do ( rem echo Loop iteration count %%x taskkill /im thunderbird.exe ) taskkill /f /im thunderbird.exe timeout 10 start "" "C:\Program Files\Beyond Compare 4\BCompare.exe" "@D:\BC_Sync\Thunderbird Snapshot to H.txt" /wait timeout 10 start "" "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe" '
附加的畫面擷圖

由 gunrunnerjohn 於 修改

所有回覆 (6)

more options

I don't see why any backup process involves the TB exe file, except to close it. Just backup the profile folder in ../AppData/Roaming/Thunderbird/Profiles/<xxxxxxxx.profilename> while TB is closed.

Scheduled backups can also be run while TB is running with the ImportExportTools NG add-on (see picture).

more options

It's real simple why TB is in there, I have to close it first, then I want it open after the automated backup runs. That's what I call automated. ;)

I'm looking at ImportExportTools NG, but I don't see how to actually kick off a backup with it. Is there a way to configure it for a fixed time? The only way I could see to manually start a backup was to do a backup on exit.

more options

I think you'll get more information about the add-on's backups by referring to the support site under Issues, e.g.:

https://github.com/thundernest/import-export-tools-ng/issues/187

more options

Interesting, that thread seems to suggest that the backups only happen when you close TB, even if you schedule them daily. That's always been the way I had to do backups to get all the data, close TB and then copy the profile.

It would be great if it could backup while running on the schedule, that's what I'm trying to achieve. Having to shutdown TB every time to get the backup to run isn't what I had in mind. If I'm going to shut TB down to do the backup, I can kick off my backup manually myself. A bonus of me doing the backup myself outside of TB is it's a whole lot faster! It takes ImportExportTools NG about 15 minutes to do the full backup, I can simply copy the whole TB profile folder in about three minutes with a simple file copy.

Another issue is when you exist TB, the backup window stops there and needs you to click OK to continue, I really want it to be automated.

more options

I don't think there's much documentation on the IET NG backup process, and as you've found, the manual copying of the profile is quick and straightforward.

more options

Yep, I was hoping to automate the entire process so it just happened at a set time of day. I guess a totally automated solution isn't quite in my grasp yet. :)