I have 18.04 and default desktop (IMHO GNOME) and XFCE. I need my home directories are located on external HDD and I can unmount it at any time.
Today I was surprised when I unmounted HDD and mounted HDD at once and then I tried to get access to XFCE. I got an error:
Unable to Load Failsafe Session
...
I understood that I need to restart XFCE.
xfce4-session-logout doesn't suit me in that case. It shows dialogue and doesn't log out itself.
When I work I use Windows (where no opportunity to install X11 or emulator of X11) and the remote connection (XRDP, SSH).
After work I do that:
killall -u user1
umount /mnt/hdd1
I can unmount HDD 'cause I do killall. I manually do these actions via SSH only.
What commands do I need to restart XFCE/GNOME (I think that it has the same problem) without any dialogues via SSH?
UPDATE:
Maybe, I change the structure of unmounting HDD. Let's say I logout DE first. But what commands are?
[logout from DE]
killall -u user1
umount /mnt/hdd1
It seems I need commands for log out all users logged into DE.