Hello,
I'm stuck and confused as to why when I execute things form the command line it works but when in a script it doesn't.
My script:
### creating a lock on the console
touch /var/run/console.lock
chmod 600 /var/run/console.lock
echo "$User" >> /var/run/console.lock
touch /var/run/console/larry
chmod 600 /var/run/console/larry
echo "1" >>/var/run/console/larry
rm -f /tmp/.X0-lock
\#\#\# stopping the gnome-login manager
for pid in \`ps -ae|grep gdm|awk '\{print $1\}'|sort -r\`
do
kill -9 $pid
done
rm -f /tmp/.X0-lock
\#\#\# getting the Gnome Desktop Manager
kill -9 \`ps -aef|grep gdm|grep X|awk '\{print $2\}'\`
su - larry -c 'exec /bin/sh' <<EOF
xauth list|grep \`hostname\` >/dev/null
if [ $? -ne 0 ]
then
xauth generate :0 .
fi
\#\#\#\# start the default desktop
/usr/bin/X11/startx& >/dev/null 2>&1
EOF
It does not work but if I rlogin form another machine and run the scipt on the command line (execute each line at the prompt) it works. This is REDHAT 7.2
Thanks