I couldn't find any solid document online. Here are the steps to configure Gerrit server to automatically start upon system boot on Ubuntu.

Here are the version numbers on my setup, your mileage may vary.

Ubuntu

1
2
3
4
5
6
7
8
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:   trusty
$ uname -a
Linux platform 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Gerrit 2.9.1, site directory is /srv/gerrit2.

First, modify the gerrit.sh script, change:

1
# Required-Start: $named $remote $syslog

To this line:

1
# Required-Start:    $all

Note the line is still commented.

Second, make the proper symlinks:

1
2
$ sudo ln -sfv /srv/gerrit2/bin/gerrit.sh /etc/init.d/gerrit
$ sudo update-rc.d gerrit defaults 92

Finally, we need to tell Gerrit the site directory.

1
$ echo "GERRIT_SITE=/srv/gerrti2" > /etc/default/gerritcodereview

You should be good to go. Restart the server and Gerrit should be up and running as well.

Thanks to this post:

http://askubuntu.com/questions/721478/ubuntu-init-d-configuration-not-starting-gerrit-2-11-4-at-boot