My first inclination would be to have supervisor run "sudo -u ubuntu 
/usr/bin/vncserver -fg -geometry 1024x768 :1".

In the case of vncserver, you will run into another problem.  If vncserver dies 
unexpectedly, the 2nd instance of vncserver that supervisor tries to start will 
not stay up, because the lock file /tmp/.X1-lock will still exist from the 
first instance, as follows:
Warning: hostname:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server hostname:1
A VNC server is already running as :1

Because of this vncserver-specific complication, I would go even further and 
suggest that supervisor should run a shell script that does this cleanup (rm 
/tmp/.X1-lock), set (and export) up your environment variables, and then 'exec 
vncserver ....'.

The 'exec' is to make sure that the vncserver process overlays the shell script 
PID, and does not result in an intermediate subshell between supervisor and 
vncserver.  This way, the vncserver remains a direct child process of 
supervisor, not a grandchild.  This is important because supervisor sends its 
termination signals only to its direct children.

Hope it helps!



tlj

From: supervisor-users-boun...@lists.supervisord.org 
[mailto:supervisor-users-boun...@lists.supervisord.org] On Behalf Of Debnath 
Sinha
Sent: Thursday, October 03, 2013 5:12 PM
To: supervisor-users@lists.supervisord.org
Subject: [Supervisor-users] Trying to start vncserver using supervisord

I'm trying to start vncserver inside an lxc using supervisord. Since 
supervisord is starting as root, I have added user=ubuntu to the config to run 
it as "ubuntu" user.
Here is the config:



[program:vnc]

directory=/

user=ubuntu

environment=HOME="/home/ubuntu",USER="ubuntu"

priority=901

command=/usr/bin/vncserver -fg -geometry 1024x768 :1
However, it is not finding the password file in /home/ubuntu/.vnc/passwd, my 
question is whether I need to do something special to set $HOME to /home/ubuntu 
or whether I should expect these to bet set when I asked supervisor to run it 
as user=ubuntu?
Is setting user=ubuntu the same as doing: su ubuntu; <cmd>?

Thanks,
-Debnath


_______________________________________________
Supervisor-users mailing list
Supervisor-users@lists.supervisord.org
https://lists.supervisord.org/mailman/listinfo/supervisor-users

Reply via email to