You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Gregory Piñero <gr...@gmail.com> on 2005/09/27 05:07:57 UTC

Setting up svnserve on Linux/Ubuntu

Hi guys,

I made a repository on my new Ubuntu computer, and I started the svnservee
daemon by running:

$ svnserve -d -r /myrepo/

And everything works great, but now I want this daemon to be started
whenever the computer is started and to be "respawned" if the process
ever dies? How I would I go about doing this? (I'm new to linux)

Much thanks,

--
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com <http://www.blendedtechnologies.com>)

Re: Setting up svnserve on Linux/Ubuntu

Posted by Ximon Eighteen <xi...@int.greenpeace.org>.
Gregory Piñero wrote:
> Hi guys,
> 
> I made a repository on my new Ubuntu computer, and I started the svnservee
> daemon by running:
> 
> $ svnserve -d -r /myrepo/
> 
> And everything works great, but now I want this daemon to be started
> whenever the computer is started and to be "respawned" if the process
> ever dies? How I would I go about doing this? (I'm new to linux)

Four ideas (maybe three and a half):-

1. Add a script in /etc/init.d/ and use chkconfig to enable it.
2. Use a tool like DaemonTools. (http://cr.yp.to/daemontools.html)
3. Use inittab.
4. For a simple user space solution maybe you could just use a KDE 
startup script or something? (not applicable to a server).

1) will allow your computer to start svnserve when the computer starts 
(more technically it starts svnserve in the runlevels you specify).

2)+3) can give you "respawning".

2) requires root access to modify the inittab line, and root access if 
you ever want to actually stop (i.e. not stop and restart) svnserve.

3) requires root just once to run DaemonTools then afterwards 
DaemonTools command line commands can be run by any user.

A modification of 3) is to use a script to do the work on inittab for 
you in a safe way and make that executable by non root users. This is 
the process I use.

Quick inittab primer:

inittab is the configuration file read by the init process (see man 
inittab and man init for much more). You can add a line like this to 
inittab:-

   svn:2345:respawn:/path/to/svnserve -d -r /myrepo/

And tell init that its' file has changed:-

   telinit q (or just init q)

Now init will launch (if you are in runlevel 2, 3, 4 or 5) your command 
(svnserve) and if it dies it will relaunch it. If your command starts 
and dies too quickly init will throttle it (it will stop attempting to 
run it for five minutes).

To stop svnserve completely edit the line by prefixing it with a # and 
run telinit q again. Init will stop svnserve (sig TERM followed by sig 
KILL if needs be).

Ximon


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Setting up svnserve on Linux/Ubuntu

Posted by Nick Vargish <ni...@vargish.org>.
On Sep 27, 2005, at 1:07 AM, Gregory Piñero wrote:
> And everything works great, but now I want this daemon to be  
> started whenever the computer is started and to be "respawned" if  
> the process
> ever dies?  How I would I go about doing this?  (I'm new to linux)

Create a file /etc/xinetd.d/svn that has the following contents:

service svn
{
     disable = no
     port = 3690
     socket_type = stream
     protocol = tcp
     wait = no
     user = svn
     server = /usr/bin/svnserve
     server_args = -i -r /myrepo
}

Replace /myrepo with the appropriate directory, of course. And set the
"user" variable to the user who owns the repository directory. Then
restart xinetd with "sudo /etc/init.d/xinetd restart".

You should be good to go.

Nick

-- 
Nick Vargish  ::  nick@vargish.org  ::  http://nick.vargish.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org