Thunderbird is a great email client from Mozilla, most know for the great (again) Firefox browser.
As I said, Thunderbird is a client. As such, it is not meant to run in the background, as a service, as a server would.
Never mind... I want Thunderbird to run in the background, such as my email accounts are synchronised and available 24/7 in a blink.
The good thing is that Xpra allows to create an X display, run X11 programs inside the display, and connect/disconnect to that display at will, locally or remotely.
Install Xpra
DISTRO=$(lsb_release -sc)
#install https support for apt (which may be installed already):
sudo apt update
sudo apt install apt-transport-https software-properties-common
sudo apt install ca-certificates
# add xpra GPG key:
sudo wget -O "/usr/share/keyrings/xpra.asc" https://xpra.org/xpra.asc
# add the xpra repository:
sudo wget -O "/etc/apt/sources.list.d/xpra.sources" https://raw.githubusercontent.com/Xpra-org/xpra/master/packaging/repos/$DISTRO/xpra.sources
sudo apt update
sudo apt install xpra
Create service file
sudo nano ~/thunderbird.service
>>[Unit]
>>Description=Thunderbird in Xpra display
>>After=network-online.target
>>Wants=network-online.target systemd-networkd-wait-online.service
>>#RequiresMountsFor=/mnt/johnHDD
>>
>>[Service]
>>User=djzu
>>Group=djzu
>>ExecStart=xpra start :10 --start-child='/usr/bin/thunderbird --daemon=no --opengl=no' --exit-with-children
>>RemainAfterExit=no
>>Restart=on-failure
>>
>>[Install]
>>WantedBy=multi-user.target
Install service
sudo systemctl link ~/thunderbird.service
sudo systemctl start thunderbird
sudo systemctl enable thunderbird
Create desktop file
Command: xpra attach --notifications=no :10
Now your emails are constantly synced, backed up and available offline, instantly. 🤘