Use i5/OS™ control language (CL) commands to start and stop a Virtual Network Computing (VNC) server, and to display information about the currently running VNC servers.
The following example is one way to set the DISPLAY environment variable and start VNC automatically by using control language (CL) commands:
CALL QP2SHELL PARM('/QOpenSys/QIBM/ProdData/DeveloperTools/vnc/vncserver_java' ':n') ADDENVVAR ENVVAR(DISPLAY) VALUE('systemname:n')
where:
The following code shows one way to stop a VNC server from a CL program:
CALL QP2SHELL PARM('/QOpenSys/QIBM/ProdData/DeveloperTools/vnc/vncserver_java' '-kill' ':n')
where n is the numeric value that represents the display number that you want to terminate.
To determine what (if any) VNC servers are currently running on an iSeries system, complete the following steps:
CALL QP2TERM
ps gaxuw | grep Xvnc
The resulting output from this command will reveal running VNC servers in the following format:
john 418 0.9 0.0 5020 0 - A Jan 31 222:26 /QOpenSys/QIBM/ProdData/DeveloperTools/vnc/Xvnc :1 -desktop X -httpd jane 96 0.2 0.0 384 0 - A Jan 30 83:54 /QOpenSys/QIBM/ProdData/DeveloperTools/vnc/Xvnc :2 -desktop X -httpd
Where:
Note: The Xvnc process, shown in the previous example output, is the name of the actual VNC server program. You start Xvnc when you run the vncserver_java script, which prepares the environment and parameters for Xvnc and then starts Xvnc.