0

I'm configuring Subversion and want it to start at boot. Used following command series:

sudo mkdir /var/svn
sudo useradd -r -s /bin/false svn
sudo mkdir /etc/svn
sudo cp /home/zipo/svnserve /etc/svn/svnserve
sudo chown root:root /etc/svn/svnserve
set execute to owner/group/other
sudo nano /lib/systemd/system/svn.service
sudo systemctl daemon-reload
sudo systemctl enable svn
sudo systemctl start svn

When I type manually command to start service sudo systemctl start svn in the syslog following log entry appears:

    Oct 29 10:13:27 testserver systemd[1]: Started SVN server.
    Oct 29 10:13:27 testserver svnserve[3128]:  * Starting svnserve...
    Oct 29 10:13:27 testserver svnserve[3128]:    ...done.

But service is not working. I'm checking it on the correct port 9999, like stated in the configuration. If I run it manually with following command it starts and works correctly: sudo -H -u svn bash -c '/etc/svn/svnserve start'

What am I missing?

svn.service file content:

    [Unit]
    Description=SVN server
    After=network.target

    [Service]
    User=svn
    Group=svn
    Type=simple
    ExecStart=/etc/svn/svnserve start
    GuessMainPID=no

    [Install]
    WantedBy=multi-user.target

svnserve file content:

    #! /bin/sh -e
    #
    # svnserve - brings up the svn server so anonymous users
    # can access svn
    #

    # Get LSB functions
    . /lib/lsb/init-functions
    . /etc/default/rcS

    SVNSERVE=/usr/bin/svnserve
    SVN_USER=svn
    SVN_GROUP=svn
    SVN_REPO_PATH=/var/svn/

    # Check that the package is still installed
    [ -x $SVNSERVE ] || exit 0;

    case "$1" in
            start)
                    log_begin_msg "Starting svnserve..."
                    umask 002
                    if start-stop-daemon --start \
                    --chuid $SVN_USER:$SVN_GROUP \
                    --exec $SVNSERVE \
                    -- -d --listen-port=9999 -r $SVN_REPO_PATH; then
                            log_end_msg 0
                    else
                            log_end_msg $?
                    fi
            ;;

            stop)
                    log_begin_msg "Stopping svnserve..."
                    if start-stop-daemon --stop --exec $SVNSERVE; then
                    log_end_msg 0
                    else
                    log_end_msg $?
                    fi
            ;;

            restart|force-reload)
                    "$0" stop && "$0" start
            ;;

            *)
            echo "Usage: /etc/init.d/svnserve {start|stop|restart|force-reload}"
                    exit 1
            ;;
    esac

    exit 0
2
  • 1
    Your svnserve script is an old init script, you shouldn't use it anymore. Instead systemd should start /usr/bin/svnserve directly. Oct 29, 2020 at 9:27
  • How can I state all parameters under ExecStart? I tried /usr/bin/svnserve -d --listen-port=9999 -r /var/svn/ but it is not working in the logs I see that svnserve does not see parameters for some reason: svnserve[4165]: You must specify exactly one of -d, -i, -t or -X.
    – Index
    Oct 29, 2020 at 10:04

1 Answer 1

1

The following unit definition is working for me:

[Unit]
Description=SVN server
After=network.target

[Service]
User=svn
Group=svn
Type=forking
ExecStart=/usr/bin/svnserve -d --listen-port=9999 -r /var/svn

[Install]
WantedBy=multi-user.target

Note that I set Type=forking because svnserve daemonizes itself with -d.

Side note: Your own service definitions should go to /etc/systemd/system/, /lib/systemd/system/ is reserved for unit definitions that come with system packages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .