Code Monkey home page Code Monkey logo

runvncserver's Introduction

startvnc

Shell script to run TigerVNC server on the actual desktop (scraping).

Prerequisites

TigerVNC server installed (tigervnc-scraping-server on debian)

How it works

The script checks, if you have already a .vnc Directory in your home ($HOME). You have to set a vnc password with the "vncpasswd" command, this will result a ~/.vnc/passwd file.
On debian, the default TigerVNC server binary for scraping is a symbolic link in /usr/bin/x0vncserver (where x0 means the Xsession at display :0). This x0vncserver is a 'dummy' version of the main TigerVNC server binary. Unlike the full version, this doesn't create a virtual display, instead it just shares the current X session at display :0.

Features

The script runs in the background, creates a logfile (default ~/.vnc/logfile), where it stores the actual x0vncserver logging information. There is also a pid file, default ~/.vnc/${HOSTNAME}${DISPLAY}.pid where the process id is stored.

The default port is for the :0 display 5900. If you want to change it, just edit VNCPORT="5900" to whatever port you want the TigerVNC server to listen to.

Usage

startvnc start|stop|restart|status

start - will start the TigerVNC Server on display :0 (scraping) default on port 5900
stop - will kill the TigerVNC Server on display :0
restart - will restart the TigerVNC Server on display :0 (if it's not running, it will just start it)
status - will tell whether the TigerVNC Server is running or not

Files

  • $HOME/.vnc
    main TigerVNC server user directory (if it doesn't exist, create it with mkdir -p ~/.vnc)
  • $HOME/.vnc/passwd
    password file for VNC Server (if it doesn't exist, create it with vncpasswd)
  • $HOME/.vnc/logfile
    logfile location (created by script)
  • $HOME/.vnc/hostname:0.pid
    pid file (created by script)

Notes

Kill the TigerVNC Server on command line

There's a command for killing the vnc server on the command line, by vncserver -kill :0 if the vnc server runs at the :0 display, reads the actual pid from the file and kills it.
However, this command looks for the pid file in your ~/.vnc directory.
The pid file format must be as following: ~/.vnc/${HOSTNAME}${DISPLAY}.pid

Automatic Start

If you want to automatically start with the Xsession, you can put it to your ~/.xsessionrc Like this:

user@linux:~$ cat ~/.xsessionrc
/home/user/runvncserver/startvnc start >/dev/null 2>&1

Links

For further information, please take a look at the TigerVNC server documentation files on

TODO

In the future, I try to implement a separate logfile for the script, since the logfile stored in ~/.vnc/logfile has only the TigerVNC Server output.

Further, I want to test it on other linux systems, whether it is working there, too, since this script was written on a debian machine (Debian stretch). Feel free to write me if you have any issues on other distributions or architectures.

Author

István Sebestyén-Teleki

Any patches or suggestions are welcome!

runvncserver's People

Contributors

sebestyenistvan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.