4

I have an application that I'd like to run, yet I'd like it to be visible only through a certain VNC port.

I don't want the app to show up on the normal Ubuntu desktop. I want the app to run "in the background", and be viewable through VNC only. And when connected to this "alternate X server", the end-user wouldn't see any menu bars, no window decorations.. Just the app.

Come to think of it, what I'm asking for is a sort of kiosk-mode for only a certain app, accessible through VNC.

Is this possible or am I really reaching here?

Thanks!

Note that the app I wish to run in this fashion is written in Java. It is a JNLP file.

1 Answer 1

1

I have successfully accomplished this. Here's how.


Install the necessary software.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer xvfb x11vnc vnc-java blackbox xterm

Set a password for the VNC connection.

x11vnc -storepasswd

Create a script file to run with cron.

sudo nano /sflowtrend.sh

These are the contents of the file.

#!/bin/bash

log="/sflowtrend.log"

echo "Closing existing sFlowTrend windows gracefully." > $log
DISPLAY=:1 wmctrl -c "sFlowTrend"
sleep 5


echo "Killing all existing instances of java, Xvfb, and x11vnc." >> $log
for i in {1..3} ; do
        killall -q java
        killall -q x11vnc
        killall -q Xvfb
        echo "Iteration $i of kill cycle complete." >> $log
        sleep 2
done

echo >> $log

Xvfb :1 -screen 0 1200x800x24+32 -ac &
echo "Fake X launched." >> $log

x11vnc -display :1 --nocursor --httpdir /usr/share/vnc-java --httpport 6789 --usepw --forever --quiet --shared &
echo "VNC launched." >> $log

DISPLAY=:1 blackbox &
echo "BlackBok launched." >> $log

DISPLAY=:1 javaws /home/administrator/Downloads/sFlowTrend.jnlp &
echo "sFlowTrend (Java) launched." >> $log

echo >> $log

echo "Sleeping for one minute." >> $log
sleep 10
echo "Sleeping for fifty seconds." >> $log
sleep 10
echo "Sleeping for forty seconds." >> $log
sleep 10
echo "Sleeping for thirty seconds." >> $log
sleep 10
echo "Sleeping for twenty seconds." >> $log
sleep 10
echo "Sleeping for ten seconds." >> $log
sleep 10

echo >> $log

DISPLAY=:1 wmctrl -r "sFlowTrend" -b add,fullscreen
echo "sFlowTend now running in fullscreen." >> $log

echo >> $log

echo "Have fun!" >> $log

Edit root's crontab.

sudo crontab -e

Add the following line to the end of the crontab.

@reboot bash /sflowtrend.sh

Reboot, and try connecting to your server, port 6789

http://ubuntu-hostname:6789

This worked for me, and I wanted to share.

Have fun!


Sources

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .