PDA

View Full Version : VNC server OStemlplate fixing - kill the Xtightvnc process manually



Fli
01-05-2014, 09:41 PM
I got an OpenVZ OStemplate with Ubuntu, VNC server and Xwindows LXDE desktop.


When OStemplate is applied on a VPS, its not connectable via VNC server, because VNC session .pid file is named as old hostname.

Saying errors like:


service vncserver restart * Stoping vncserver for user 'root' on localhost:1...
Can't find file /root/.vnc/mynewhostname:1.pid
You'll have to kill the Xtightvnc process manually


* Starting vncserver for user 'root' on localhost:1...
Warning: mynewhostname:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server mynewhostname:1
A VNC server is already running as :1

and


# vncserver -kill :1

Can't find file /root/.vnc/mynewhostname:1.pid
You'll have to kill the Xtightvnc process manually

The solution can be to kill vncserver; remove old vnc server .pid file from /root/.vnc/ and remove X windows temp folder; start vnc server:


pkill vncserver;rm -rf /root/.vnc/*:*;rm -rf /tmp/.X1*;vncserver
(or trying: rm -rf /tmp/.X1-lock )
(try on your own risk!)

i would first try:
vncserver -kill :1

if works, just do "vncserver" to start


Need to automate this proces in OStemplate?

create OStemplate with following files. (cronjtab must be installed: apt-get install cron)

cd /etc/cron.d
touch cron.sh;chmod +x cron.sh;vi
add into:
* * * * * thecommands to execute;next command to execute;rm -rf /etc/cron.d/cron.sh;

that should run the task in first minutes new server is running and delete itself