# svnserve.conf



## balanga (Jul 30, 2017)

svnserve.conf() states


```
svnserve.conf  controls    the  behavior of the svnserve daemon on    a per-
      repository basis.  It is    located    in the conf subdirectory of the    repos-
       itory.
```

I can't figure out how this works...  When the svnserve daemon starts how does it know  the location of the conf subdirectory of the repository so how can it be controlled?


----------



## Jov (Jul 30, 2017)

From the rc file [1], the default location of all repositories is /home/svn/repos, you can change it by setting svnserve_data=your_repos_dir in /etc/rc.conf or /usr/local/etc/rc.conf.
You should init create the repos under $svnserve_data, then when svnserve start will find it as a subdir in $svenserve_data.The svnserve.conf should be placed in the subdir. 

[1]https://svnweb.freebsd.org/ports/head/devel/subversion/files/svnserve.in?view=markup


----------



## balanga (Jul 30, 2017)

Just to clarify things...svnserve.conf ()

```
NAME
      svnserve.conf - Repository configuration    file for svnserve

SYNOPSIS
       repository-path/conf/svnserve.conf
```

Do i take it that 'repository-path' is equivalent to 'svnserve_data' in /etc/rc.conf?

I'm not sure if there can be one common svnserve.conf or is there one for every project under 
/var/svn/repo

Either:
_/var/svn_/repo/conf/svnserve.conf

or:
_/var/svn_/repo/proj-1/conf/svnserve.conf
_/var/svn_/repo/proj-2/conf/svnserve.conf


----------



## obsigna (Jul 30, 2017)

balanga said:


> ...
> Do i take it that 'repository-path' is equivalent to 'svnserve_data' in /etc/rc.conf?



Yes, see line 16 of file /usr/local/etc/rc.d/svnserve



balanga said:


> I'm not sure if there can be one common svnserve.conf or is there one for every project under /var/svn/repo
> 
> Either:
> _/var/svn_/repo/conf/svnserve.conf
> ...



You can have both, see the last paragraph of svnserve(8)

```
Unless the --config-file option was specified on the command line, once
       the client has selected a repository by transmitting its URL, svnserve
       reads a file named conf/svnserve.conf in the repository directory to
       determine repository-specific settings such as what authentication
       database to use and what authorization policies to apply.  See the
       svnserve.conf(5) man page for details of that file format.
```
You need to append said --config-file option to the svnserve_flags directive into /etc/rc.conf:
svnserve_flags="-d --listen-port=3690 --listen-host 0.0.0.0 --config-file=/path/to/the/global/svnserve.conf"

There is even a third option, which I use for my repositories, some of which require different credentials than others. I created one conf directory for each group of credentials for the various repositories, and then I symlinked these conf dirs into each repository of the respective group. For example:
`# sudo -u svn`
`$ rm -r /var/svn/repo/proj-1/conf; ln -s /var/svn/config/group1 /var/svn/repo/proj-1/conf`
`$ rm -r /var/svn/repo/proj-2/conf; ln -s /var/svn/config/group1 /var/svn/repo/proj-2/conf`
`$ rm -r /var/svn/repo/proj-3/conf; ln -s /var/svn/config/group2 /var/svn/repo/proj-3/conf`
`$ rm -r /var/svn/repo/proj-4/conf; ln -s /var/svn/config/group2 /var/svn/repo/proj-4/conf`


----------



## balanga (Jul 30, 2017)

I made some changes following your advice and wanted to test them, but when I run

`service svnserve stop`

The system says Operation not permitted.

I noticed using the 'help' command that there is a 'force' option, but when running

`service svnserve force stop`

I  just get a 'Usage:' response.

Anyone know why I can't stop svnserve?


----------



## obsigna (Jul 30, 2017)

balanga said:


> ...
> `service svnserve stop`
> 
> The system says Operation not permitted.
> ...



Either login as user root, then:
`# service svnserve stop`

Or:
`$ sudo service svnserve stop`


----------



## SirDice (Jul 31, 2017)

balanga said:


> I noticed using the 'help' command that there is a 'force' option, but when running
> 
> `service svnserve force stop`


It's one word: `service svnserve forcestop`


----------



## balanga (Jul 31, 2017)

Thanks, I gave that a try... 

```
# service svnserve forcestop
Stopping svnserve.
kill: 21416: Operation not permitted
Waiting for PIDS: 21416
```

and it's still waiting 30 mins later...


----------



## SirDice (Jul 31, 2017)

What happens if you run (as root of course): `kill 21416` or `kill -9 21416` (The last kill(1) will forcefully kill a process, use sparingly, especially with database services because it can leave the database files in a weird state)


----------



## balanga (Jul 31, 2017)

Thanks, that worked.


----------

