LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   auto execution script (https://www.linuxquestions.org/questions/linux-general-1/auto-execution-script-37688/)

nimrod 12-08-2002 06:31 PM

auto execution script
 
hi, I'm really new with linux
(I installed RedHat 7.3 yesterday)
:newbie:
I have a linux server without screen or keyboard,
and I control it using vncserver.
I would like to start vncserver automatically when the server
starts, without having to plug any screen or keyboard on it.

I would like to do something like this :

su user1
vncserver &
exit

su user2
vncserver &
exit

in order to have two servers, one for each user.

I've read that I should write it in etc/rd.local.
I tried but it didn't work, it seems that only 'su user1' had been
executed.

Thanks for your help !

jetfreggel 12-08-2002 11:37 PM

try to chmod 700 ./scriptfile and then try to execute it ./scriptfile



good luck

SlickWilly 12-09-2002 03:20 PM

Um.. I'm not sure it's a scriptfile he's having a problem with. vnc comes as a package in Redhat (compiled binary) and all set up to go.

It does however, require a bit of reading of the manual. :(

I'm not sure why you're su'ing to various users.

However, man vncserver says this :

:number
The display number to use. If omitted, the next free display number is used.

so, you can do this in your startup script :

vncserver :1
vncserver :2

Looking further I see a file /etc/sysconfig/vncservers :

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the line below to start a VNC server on display :1
# as my 'myusername' (adjust this to your own). You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/vnc/sshvnc.html>.

# VNCSERVERS="1:myusername"

One would imagine you'd need to set up your displays like :

VNCSERVERS="1:fred"
VNCSERVERS="2:barney"

and man vncpasswd.

Looking at your script, and looking at how the above works it seems like you're running the same instance of a single vnc server twice... the first will be replaced with the second...

Looking at 'man vncpasswd' I can see why you're su'ing to two different users. Perhaps you could set up a file to store your passwords make it root writable and have both passwords in the same place.

Slick.


All times are GMT -5. The time now is 09:56 AM.