Run script to restart displaymanager on logout?

We’re having trouble with VNC remote administration hanging or freezing all the time. When someone logs out or disconnects from VNC. systemctl restart displaymanager vncmanager usually fixes it. I would like to do this on every logout. I tried using /etc/gdm/PostSession but it isn’t working. Any ideas how I could do this? systemd service?

I use KDM3 from repo as default-displaymanager. I have it configured via kdmrc to restart on every session exit. I’ve never used GDM, so have no idea what it’s capabilities are.

I would expect Ctrl-Alt-BS or Ctrl-Alt-BS twice quickly should have the same effect from the GDM login screen, but Ctrl-Alt-BS might need to be enabled via /etc/X11/xorg.conf.d/.