You are not logged in.

#1 2010-09-28 01:03:24

vinhsynd
Member
Registered: 2010-08-05
Posts: 56

Prefered Arch Method for starting VNC

I'm doing what I usually do when I'm given options and have no idea what is better - ask everyone here for their opinion on the issue.

This one is pretty straight forward: I'd like to use TightVNC over SSH for accessing my desktop both at home and over the internet. The wiki is pretty darn straight forward and I've gotten things working over SSH. The problem is how do people like to start their VNC server?

The wiki mentions just adding it to rc.local/rc.local.shutdown
Other people seem to like using xinetd

What is the opinion around here and are there any glaring pros or cons for one over the other?

Last edited by vinhsynd (2010-09-28 01:03:42)


The older I get the less time I have.

Offline

#2 2010-09-28 04:38:27

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: Prefered Arch Method for starting VNC

So you want it started automatically at every boot? I would put it in rc.local
The other option is to write a daemon script and put it in /etc/rc.d/


neutral

Offline

#3 2010-09-29 02:30:49

vinhsynd
Member
Registered: 2010-08-05
Posts: 56

Re: Prefered Arch Method for starting VNC

Edited for being stupid.

Here is a Wiki page on how to make Daemon scripts:

http://wiki.archlinux.org/index.php/Wri … .d_scripts

Last edited by vinhsynd (2010-09-29 02:33:11)


The older I get the less time I have.

Offline

#4 2010-09-29 15:13:20

vinhsynd
Member
Registered: 2010-08-05
Posts: 56

Re: Prefered Arch Method for starting VNC

I've tried making a rc.d script. I haven't written one before so I used the above entry in the ArchWiki and the chapter in the FreeBSD Handbook on making rc.d scripts. Unfortunately for me, my script doesn't seem to work after including it in the rc.conf daemon section. I've included the script below for any advice:

/etc/rc.d/xvnc

#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/xvnc.conf

daemon_name = Xvnc

XVNC_ARGS=[-f /etc/conf.d/xvnc]

PID='pidof -o %PPID /usr/bin/xvnc'

case "$1" in
    start)
         stat_busy"Starting $daemon_name daemon"
         [ -z "$PID" ] && su nobody /usr/bin/xvnc ${XVNC_ARGS}
         if [ $? -gt 0 ]; then
             stat_fail
         else
             add_daemon xvnc
             stat_done
         fi
         ;;
     stop)
         stat_busy "Stopping $daemon_name daemon"
         [ ! -z "$PID" ] && kill $PID &> /dev/null
         if [ $? -gt 0 ]; then
             stat_fail
         else
             rm_daemon xvnc
             stat_done
         fi
         ;;
     restart)
         $0 stop
         $0 start
         ;;
     *)
      echo "usage: $0 {start|stop|restart}"
esac
exit 0

/etc/conf.d/xvnc

XVNC_ARGS="-localhost -geometry 1024x768 -securitytype none -rfbport 5901"

The older I get the less time I have.

Offline

#5 2010-09-30 03:13:33

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: Prefered Arch Method for starting VNC

What are the permissions on the script?


neutral

Offline

#6 2010-09-30 07:20:14

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Prefered Arch Method for starting VNC

vinhsynd wrote:

The wiki mentions just adding it to rc.local/rc.local.shutdown

Yeah, I wrote most of that page.  The rc.local methods are more or less functionally, the same as your more complicated daemon method.  KISS in my opinion tongue  Why write a daemon when a one-line addition to a file does it?

Last edited by graysky (2010-09-30 07:21:13)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#7 2010-09-30 13:32:09

vinhsynd
Member
Registered: 2010-08-05
Posts: 56

Re: Prefered Arch Method for starting VNC

sand_man:

I have the script as premissions as rwxr-xr-x


graysky:

Well I actually didn't know what was the better way to run it as there are some vocal supporters of using xinetd looking around on google (some people are big fans of having each connection spawn a new xvnc process). sand_man suggested writting a daemon script and that was enough of a nudge to start thinking "yeah it would be fun to learn how to write an rc.d script". Thank you for writting the Wiki page, I would have been lost getting things working intially without it.

Last edited by vinhsynd (2010-09-30 13:36:26)


The older I get the less time I have.

Offline

#8 2010-09-30 18:51:13

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Prefered Arch Method for starting VNC

@vin - doing for the sake of learning is always a good idea.  I didn't mean to throw water on you.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#9 2010-09-30 22:24:30

vinhsynd
Member
Registered: 2010-08-05
Posts: 56

Re: Prefered Arch Method for starting VNC

I didn't feel any water smile


The older I get the less time I have.

Offline

Board footer

Powered by FluxBB