![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script through cron and command line | rahulrathod | UNIX for Dummies Questions & Answers | 3 | 02-22-2008 07:10 AM |
| Script an Oracle Command Line Blackout | pattieatte | Shell Programming and Scripting | 0 | 08-30-2007 05:28 PM |
| script works on command line, not in cron job | JackTheTripper | UNIX for Dummies Questions & Answers | 7 | 06-27-2007 02:51 AM |
| Script doesn't work, but commands inside work | cheongww | UNIX for Dummies Questions & Answers | 2 | 11-14-2006 10:52 PM |
| Command work but not in SH script | cititester | UNIX for Dummies Questions & Answers | 3 | 03-06-2006 04:03 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
command line work script doesn't
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 |
|
||||
|
oombra,
Every thing seems to execute with the except when I execut the startx command. As root on the command line things work fine but as root executing the script it doesn't work. I get is: Fatal server error: Server is already active for display 0 If this server is no longer running, remove /tmp/.X0-lock and start again. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|