here i will show how to execute an app that requires GUI (X window) to run on the background. i mean you wont be able to see the screen.
this problem is simple to solve. i used a vncserver. a vnc (virtual networking computing) server will create a virtual X server. so you actually doesnt need to have a real display. usually, vncserver is used to display an application on a different machine. a remote machine would connect to the vncserver using a vncviewer…
you will need to install a vncserver. on ubuntu i am using the package vnc4server.
after installing, the first step is to create a password using ‘vncpasswd’. this password will be used to authenticate any vncviewer trying to connect to this server. we wont setup any viewer but vncserver requires this password anyway. so just type:
now start the server
if you dont specify a display number it will get one for you. it will probably be ‘:1′
our vncserver is up and running. to use it you need to change the env variable DISPLAY to ‘:1′ (or whatever display number you got).
now any process started on this shell will use this display. since it is a virtual display you wont see anything. just what we were looking for.
some applications also have a ‘display’ parameter, so you dont need to set the env variable.
$ firefox –display=:1