In /sbin/poweroff and in /usr/bin/wmexit, at line 37 and 53, respectively (Slacko 7.0),
there is a test [ "$DISPLAY" ] that would yield a negative answer if I would have
X still running and just entered a real tty-console and issued the command
poweroff/reboot or wmpoweroff/wmreboot.
Those tests would possibly be safer in this use-case if [ -f /root/.XLOADED ] or, possibly,
some grep-construct like [ "$(ps|grep "X* :"|grep -v grep)" ] or [ "$(ps|grep "X.*:"|grep -v grep)" ]
were used.
Any thoughts? (Or have I missed something here?)
/MHHP