Never tried it, but this might work:
sudo pkill -KILL -u username
Thanks for the response. I tried that but it didn't quite work. I ended up with the big "X" on the screen. So here's what appears to work:
sudo killall Xvesa
sudo pkill -KILL -u username
edit: Actually I forgot that I had loaded procps.tce to try "skill and snice". As it turns out a different version of pkill is included as well. Seems this pkill version is what is required to logout from a script. Wow this one was hard to track down!
Note the info for procps.tce does not mention pkill as being included.