On Mon, Mar 26, 2012 at 09:47:05PM +1000, Michael D. Setzer II wrote:
> On 26 Mar 2012 at 12:51, Adam Tkac wrote:
> 
> Date sent:            Mon, 26 Mar 2012 12:51:24 +0200
> From:                 Adam Tkac <[email protected]>
> To:                   "Michael D. Setzer II" 
> <[email protected]>
> Copies to:            DRC <[email protected]>,
>               "[email protected]" 
> <[email protected]>
> Subject:              Re: [Tigervnc-users] vncserver not starting after a 
> bad restart.
> 
> > On Mon, Mar 26, 2012 at 12:36:40AM +1000, Michael D. Setzer II wrote:
> > > On 25 Mar 2012 at 8:48, DRC wrote: > > Copies to:     
> >     "[email protected]" >
> > <[email protected]> > From:              DRC
> > <[email protected]> > Subject:               Re:
> > [Tigervnc-users] vncserver not starting after a > bad restart. > Date
> > sent:       Sun, 25 Mar 2012 08:48:03 -0500 > To:            
> >     "Michael D. Setzer II" > <[email protected]> > > > > > Running >
> > > > >  vncserver -kill :79 > > > > should get rid of the file. > >
> > With prior versions of Fedora this was no problem, but not with the >
> > Fedora 16 using systemctl to setup the vnc. Where would one add > this
> > to automate the process of clearing the file?
> > 
> > I just tried this on fully updated Fedora 15 machine:
> > 
> > [atkac@f15 ~]$ touch /tmp/.X11-unix/X2
> > [atkac@f15 ~]$ vncserver :2
> > 
> > Warning: f15.atkac.brq.redhat.com:2 is taken because of
> > /tmp/.X11-unix/X2 Remove this file if there is no X server
> > f15.atkac.brq.redhat.com:2 A VNC server is already running as :2
> > 
> > So this is nothing new in Fedora 16.
> >
> I had upgraded from Fedora 14 to 16 with a clean install, but 
> never saw this with 14, so it might have been that it appeared with 
> 15. Also, it might be that previous versions had something else 
> that was clearing the tmp directory during the reboot process, but 
> is not longer being cleared out. 
> 
> 
> > > Since one now creates a startup file as:
> > > /etc/systemd/system/multi-user.target.wants/vncserver@:79.servic e
> > > 
> > > Now that has the ExecStart and ExecStop the uses the vncserver %i 
> > > 
> > > That start and stop only has running the vncserver, so how would one
> > > add it to automatically remove the file before starting it, which
> > > now fails if it does exist?
> > 
> > You can put this directive to your service file:
> > 
> > ExecStartPre=rm -f /tmp/.X11-unix/X79
> > 
> > This should automatically remove the socket before start but I don't
> > recommend it.
> 
> What would you recommend?

After second though you can add this to your service file, I will add it to the
Fedora service file as well:

# Clean any existing files, like /tmp/.X11-unix/<socket>
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

This should clean the proper X11 socket before the startup. Please check if it
works fine in your setup, thank you in advance.

Regards, Adam

> 
> My current solution has been /etc/cron.hourly with this testvnc
> This machine has 3 vnc users, most only have one thou.
> 
> run=`systemctl status vncserver@:79.service | grep running | cut 
> -b 20-26`
> #echo $run
> if [ -z "$run" ] ; then
>    rm /tmp/.X11-unix/X79
>    systemctl start vncserver@:79.service
>    rm /tmp/.X11-unix/X20
>    systemctl start vncserver@:20.service
>    rm /tmp/.X11-unix/X65
>    systemctl start vncserver@:65.service
> fi
> 
> 
> > 
> > Regards, Adam
> > 
> > > 
> > > > 
> > > > On Mar 24, 2012, at 2:55 AM, "Michael D. Setzer II"
> > > > <[email protected]> wrote:
> > > > 
> > > > > I've had the issue of the vncserver not starting after a bad
> > > > > restart where the /tmp/.X11-unix/X79 file has not been deleted
> > > > > during the shutdown (Usually a power outage). 
> > > > > 
> > > > > My current solution has been to have a script in cron.hourly
> > > > > that checks if the status is running, and if not it deletes the
> > > > > /tmp/.X11-unix/X79 file and then starts the service. 
> > > > > 
> > > > > Is there a better method to have it delete the file during the
> > > > > start process? Not sure if something else is supose to delete
> > > > > this file if it wasn't deleted during a normal shutdown.
> > > > > 
> > > > > Before I would have to manually ssh into the machines to delete
> > > > > the file, and manually restart the service. (now systemctl). 
> > > > > 
> > > > > Fedora 16 by the way.
> > > > > 
> > > > > +----------------------------------------------------------+
> > > > >  Michael D. Setzer II -  Computer Science Instructor      
> > > > >  Guam Community College  Computer Center                  
> > > > >  mailto:[email protected]                            
> > > > >  mailto:[email protected]
> > > > >  http://www.guam.net/home/mikes
> > > > >  Guam - Where America's Day Begins                        
> > > > >  G4L Disk Imaging Project maintainer 
> > > > >  http://sourceforge.net/projects/g4l/
> > > > > +----------------------------------------------------------+
> > > > > 
> > > > > http://setiathome.berkeley.edu (Original)
> > > > > Number of Seti Units Returned:  19,471
> > > > > Processing time:  32 years, 290 days, 12 hours, 58 minutes
> > > > > (Total Hours: 287,489)
> > > > > 
> > > > > BOINC@HOME CREDITS
> > > > > SETI        11969293.719299   |   EINSTEIN     7540627.629852
> > > > > ROSETTA      4338248.975416   |   ABC         11870729.099396
> > > > > 
> > > > > 
> > > > > ----------------------------------------------------------------
> > > > > ---- ---------- This SF email is sponsosred by: Try Windows
> > > > > Azure free for 90 days Click Here
> > > > > http://p.sf.net/sfu/sfd2d-msazure
> > > > > _______________________________________________ Tigervnc-users
> > > > > mailing list [email protected]
> > > > > https://lists.sourceforge.net/lists/listinfo/tigervnc-users
> > > 
> > > 
> > > +----------------------------------------------------------+
> > >   Michael D. Setzer II -  Computer Science Instructor      
> > >   Guam Community College  Computer Center                  
> > >   mailto:[email protected]                            
> > >   mailto:[email protected]
> > >   http://www.guam.net/home/mikes
> > >   Guam - Where America's Day Begins                        
> > >   G4L Disk Imaging Project maintainer 
> > >   http://sourceforge.net/projects/g4l/
> > > +----------------------------------------------------------+
> > > 
> > > http://setiathome.berkeley.edu (Original)
> > > Number of Seti Units Returned:  19,471
> > > Processing time:  32 years, 290 days, 12 hours, 58 minutes
> > > (Total Hours: 287,489)
> > > 
> > > BOINC@HOME CREDITS
> > > SETI        11969293.719299   |   EINSTEIN     7540627.629852
> > > ROSETTA      4338248.975416   |   ABC         11889193.887520
> > > 
> > > 
> > > --------------------------------------------------------------------
> > > ---------- This SF email is sponsosred by: Try Windows Azure free
> > > for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure
> > > _______________________________________________ Tigervnc-users
> > > mailing list [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/tigervnc-users
> > 
> > -- 
> > Adam Tkac, Red Hat, Inc.
> 
> 
> +----------------------------------------------------------+
>   Michael D. Setzer II -  Computer Science Instructor      
>   Guam Community College  Computer Center                  
>   mailto:[email protected]                            
>   mailto:[email protected]
>   http://www.guam.net/home/mikes
>   Guam - Where America's Day Begins                        
>   G4L Disk Imaging Project maintainer 
>   http://sourceforge.net/projects/g4l/
> +----------------------------------------------------------+
> 
> http://setiathome.berkeley.edu (Original)
> Number of Seti Units Returned:  19,471
> Processing time:  32 years, 290 days, 12 hours, 58 minutes
> (Total Hours: 287,489)
> 
> BOINC@HOME CREDITS
> SETI        11986397.250517   |   EINSTEIN     7559121.249852
> ROSETTA      4350953.015650   |   ABC         11898100.773409
> 

-- 
Adam Tkac, Red Hat, Inc.

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Tigervnc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-users

Reply via email to