2

I followed Gerrit's installation instructions.

My gerrit.sh update was, as per instructions, to uncomment these 3 lines:

# ========================
chkconfig: 3 99 99
description: Gerrit Code Review
processname: gerrit
# ========================

Question 1: Does anyone understand what these three lines do syntactically? Elsewhere someone said these were for redhat, so probably do nothing for Ubuntu and I didn't find any of them in the apt-get list. With these uncommented I get these errors from them when manually starting gerrit:

gerrit2@ubuntu:~$ ./bin/gerrit.sh start
./bin/gerrit.sh: 7: ./bin/gerrit.sh: chkconfig:: not found
./bin/gerrit.sh: 8: ./bin/gerrit.sh: description:: not found
./bin/gerrit.sh: 9: ./bin/gerrit.sh: processname:: not found
Starting Gerrit Code Review: OK

My symbolic links, as per instructions:

gerrit2@ubuntu:~/bin$ ll /etc/init.d/gerrit 
lrwxrwxrwx 1 root root 27 Jan 14 17:16 /etc/init.d/gerrit -> /home/gerrit2/bin/gerrit.sh*

and

gerrit2@ubuntu:~$ ll /etc/rc2.d/S99gerrit 
lrwxrwxrwx 1 root root 18 Jan 14 10:43 /etc/rc2.d/S99gerrit -> /etc/init.d/gerrit*

My run-level for gerrit2 user, which is why I put the above link in rc2.d vs. rc3.d (different than instructions):

gerrit2@ubuntu:/etc/rc3.d$ who -r
 run-level 2  2016-01-14 17:13

/home/gerrit2 user has GERRIT_SITE set up as per google instructions, so I added /etc/default/gerritcodereview seen on some other how-to site in case it would help init.d but it didn't:

cat /etc/default/gerritcodereview 
GERRIT_SITE=/home/gerrit2

Question 2: Any ideas on what I've done wrong here?

Notes:

I also tried rc.3 vs. rc.2. Gerrit runs and works, was able to push a few GB of sources in today. Gerrit also launches from /etc/init.d/gerrit, when given 'start' as a parameter. init.d should take care of passing in rc.d start/stop type parameters. Ubuntu 14.04 LTS Gerrit 2.11.4 service --status-all lists gerrit as not-running '-' vs. '+'

2 Answers 2

2

Ignore google's instruction, when using Ubuntu, to uncomment the 3 lines in gerrit.sh. Instead follow StephenKing's suggestion, posted on stackexchange, of replacing:

# Required-Start: $named $remote $syslog

with

# Required-Start: $all

Then run:

sudo update-rc.d -f gerrit remove
sudo update-rc.d gerrit defaults 92

Thanks StephenKing! None of the Ubuntu specific instructions I read else-where mentioned this. So there must be a bunch of manual initialized gerrit repo's out there.

0

For someone who still looking for solution. We can sysmtemd script with the following steps

$> echo "GERRIT_SITE=/home/gerrit/gerrit-server" > /etc/default/gerritcodereview
$> sudo systemctl edit --force --full gerrit-code
    [Unit] 
        Description= Gerrit Code Review Service
        After=network.target
    
    [Service]
        Type=forking
        User=gerrit
        EnvironmentFile=/etc/default/gerritcodereview
        StandardOutput=syslog
        StandardError=syslog
        SyslogIdentifier=gerrit
        ExecStart=/home/gerrit/gerrit-server/bin/gerrit.sh start
        ExecStop=/home/gerrit/gerrit-server/bin/gerrit.sh stop
    
    [Install]
        WantedBy=default.target

Then enable and start it

$> sudo systemctl enable gerrit-code
$> sudo systemctl start gerrit-code
$> sudo systemctl status gerrit-code

You must log in to answer this question.

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