I repair the behavior with following lines before the closing exit of the
script 'startx':
#------------ Script Start ------------ # get pid of tee and kill it s=`/bin/ps -C tee -o pid=,args= \ | /usr/bin/grep -m 1 "xsession-errors"` err=$? if [ "$err" -eq 0 ]; then s=${s## } pid=${s%% *} kill -s 9 $pid fi #------------ Script End --------------