Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
vncserver on startup
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
flokno
Apprentice
Apprentice


Joined: 18 Dec 2002
Posts: 185
Location: graz/austria/europe

PostPosted: Sat Feb 08, 2003 3:52 am    Post subject: vncserver on startup Reply with quote

hello!

after searching around the forum:
exactly what command do i have to add in local.start/stop for starting/stopping vnc server on boot/shutdown.

currently i have to log in and enter vncserver :1 to get my server box the way i want it to be.

any help is appreciated.

thanks, flo.
Back to top
View user's profile Send private message
crossfire
n00b
n00b


Joined: 05 Feb 2003
Posts: 4

PostPosted: Sat Feb 08, 2003 7:03 am    Post subject: init script for vnc Reply with quote

I use this init scrip:




#!/bin/bash
#
# chkconfig: - 91 35
# description: Starts and stops vncserver. \
# used to provide remote X administration services.

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

VNCSERVERS=""
[ -f /etc/sysconfig/vncservers ] && . /etc/sysconfig/vncservers

prog=$"VNC server"

start() {
echo -n $"Starting $prog: "
ulimit -S -c 0 >/dev/null 2>&1
RETVAL=0
for display in ${VNCSERVERS}
do
echo -n "${display} "
unset BASH_ENV ENV
initlog $INITLOG_ARGS -c \
"su ${display##*:} -c \"cd ~${display##*:} && [ -f .vnc/passwd ] && vncserver :${display%%:*}\""
RETVAL=$?
[ "$RETVAL" -ne 0 ] && break
done
[ "$RETVAL" -eq 0 ] && success $"vncserver startup" || \
failure $"vncserver start"
echo
[ "$RETVAL" -eq 0 ] && touch /var/lock/subsys/vncserver
}

stop() {
echo -n $"Shutting down $prog: "
for display in ${VNCSERVERS}
do
echo -n "${display} "
unset BASH_ENV ENV
initlog $INITLOG_ARGS -c \
"su ${display##*:} -c \"vncserver -kill :${display%%:*}\" >/dev/null 2>&1"
done
RETVAL=$?
[ "$RETVAL" -eq 0 ] && success $"vncserver shutdown" || \
failure $"vncserver shutdown"
echo
[ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/vncserver
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/vncserver ]; then
stop
start
fi
;;
status)
status Xvnc
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac










and I have this 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:username_here"
Back to top
View user's profile Send private message
flokno
Apprentice
Apprentice


Joined: 18 Dec 2002
Posts: 185
Location: graz/austria/europe

PostPosted: Thu Feb 13, 2003 5:47 pm    Post subject: Reply with quote

thanks, but:

i did the following cause the solution above doesn't work but gave me some ideas:

in /etc/conf.d/local.start:

su - username -c "source /etc/profile && export HOME=~ && /usr/bin/vncserver :1 -geometry 1152x864"

in /etc/conf.d/local.stop:

su - remote -c "source /etc/profile && export HOME=~ && /usr/bin/vncserver -kill :1"

any comments due to bugs or my stupidness?

-- flo
Back to top
View user's profile Send private message
kki
n00b
n00b


Joined: 21 Nov 2003
Posts: 10

PostPosted: Fri Nov 21, 2003 11:28 pm    Post subject: Reply with quote

great flokno!
it works for me :)
Back to top
View user's profile Send private message
flokno
Apprentice
Apprentice


Joined: 18 Dec 2002
Posts: 185
Location: graz/austria/europe

PostPosted: Sat Nov 22, 2003 12:19 am    Post subject: Reply with quote

i'm still using it this way...
so it should be okay.

--
flo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum