Startup Script for Subversion

Startup Script for Subversion

From Debian Wiki

Jump to: navigation, search

Contents

Introduction

One of the key issues I had with Subversion in Debian and Ubuntu was that each time you reboot your server you need to manually startup your svn server which is a pain. This quick HOWTO shows you what needs to be done to get subversion started at boot time.


Requirements

  • A Debian Etch base installation - Installation HOWTO here or an Ubuntu install will do.
  • Subversion installed on the server.
  • Root access to your server.

Create a Startup Script

All that's needed here is to create a new file and add the command to startup svnserve. This can be done as follows

cd /etc/init.d/
touch svnserve
vi svnserve

Then add the following to the file svnserve:

#!/bin/bash
### BEGIN INIT INFO
# Provides:          svnserve
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     
# Default-Stop:      
# X-Interactive:     true
# Short-Description: Start/stop svnserve
### END INIT INFO

svnserve -d -r /usr/local/svn/repository_name

Save your file and you're done.

Make the script executable

chmod +x svnserve

Add the script to the boot sequence

update-rc.d svnserve defaults

That’s it. When you’re done you should see some output similar to this on Debian Etch & Lenny:

Adding system startup for /etc/init.d/svnserve ...
  /etc/rc0.d/K20svnserve -> ../init.d/svnserve
  /etc/rc1.d/K20svnserve -> ../init.d/svnserve
  /etc/rc6.d/K20svnserve -> ../init.d/svnserve
  /etc/rc2.d/S20svnserve -> ../init.d/svnserve
  /etc/rc3.d/S20svnserve -> ../init.d/svnserve
  /etc/rc4.d/S20svnserve -> ../init.d/svnserve
  /etc/rc5.d/S20svnserve -> ../init.d/svnserve
  /etc/rc5.d/S20svnserve -> ../init.d/svnserve

On Debian Squeeze you'll see the following:

update-rc.d: using dependency based boot sequencing

Remove script from boot sequence

If you ever want to remove the script from the boot sequence you'd run the following command from terminal:

update-rc.d -f svnserve remove