CentoOS: How to auto-start Rhodecode on server reboot?

Russell Weed's Avatar

Russell Weed

15 Oct, 2014 09:28 PM

We recently had to reboot the CentOS box RhodeCode is installed on for the first time since we installed it. When it came back up, I found that RhodeCode was not running and I had to manually start it:

> sudo service rhodecode start

Subsequently, I tried adding rhodecode to chkconfig but it doesn't work:

> sudo /sbin/chkconfig --add rhodecode
> service rhodecode does not support chkconfig

There is a rhodecode script in /etc/init.d/ however? Is there anything else I can do to make RhodeCode start up automatically?

We're running CentOS release 6.5.

  1. Support Staff 1 Posted by Marcin Kuzminsk... on 30 Oct, 2014 12:22 PM

    Marcin Kuzminski's Avatar

    Hi,

    Sorry for late response, we have example init.d file you can use here:

    https://code.rhodecode.com/rhodecode/files/tip/init.d/

    hope that helps

  2. Marcin Kuzminski closed this discussion on 30 Oct, 2014 12:22 PM.

  3. Russell Weed re-opened this discussion on 30 Oct, 2014 12:28 PM

  4. 2 Posted by Russell Weed on 30 Oct, 2014 12:28 PM

    Russell Weed's Avatar

    Thank you for contacting Funds For Learning. I will be out of the office until Friday, Nov. 31. If you need immediate assistance, please contact [email blocked]

  5. 3 Posted by Rolf on 05 Nov, 2014 12:35 PM

    Rolf's Avatar
  6. Support Staff 4 Posted by Marcin Kuzminsk... on 05 Nov, 2014 02:31 PM

    Marcin Kuzminski's Avatar

    Sorry that resource was moved, i created a dedicated one: https://code.rhodecode.com/rhodecode-startup-scripts/files/tip/

  7. 5 Posted by Russell Weed on 10 Nov, 2014 04:34 PM

    Russell Weed's Avatar

    This helps, thanks. I already had the proper init.d script in my system, however after doing some more learning about what the heck init.d scripts are I learned that the RhodeCode ones do not support chkconfig out of the box. But I also learned how to add the support myself!

    I made the following edits to /etc/init.d/rhodecode:

    #!/bin/sh
    #
    ######################################
    #### THIS IS A REDHAT INIT.D SCRIPT ####
    ######################################
    # (c) 2013 RhodeCode GmbH Berlin, Germany.
    # All rights reserved.
    #
    # Author: Sebastian Kreutzberger
    # please leave feedback at https://rhodecode.com/help/
    #
    #
    # description: RhodeCode Server Startup Script
    # chkconfig: 2345 90 10
    

    Note the last 2 lines, which are new! After editing the script it now supports chkconfig:

    [username@server init.d]$ sudo chkconfig --list rhodecode
    service rhodecode supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add rhodecode')
    [username@server init.d]$ sudo chkconfig --add rhodecode
    [username@server init.d]$ sudo chkconfig rhodecode on
    [username@server init.d]$ sudo chkconfig
    ...
    rhodecode       0:off   1:off   2:on    3:on    4:on    5:on    6:off
    ...
    [username@server init.d]$ sudo service rhodecode start
    Starting RhodeCode Enterprise: Changing user to apache:apache (48:48)
    Entering daemon mode
                                                               [  OK  ]
    [username@server init.d]$
    

    Since this is just our dev server, I rebooted it as a test. RhodeCode came back up as expected!

    Please feel free to add this bit of code to https://code.rhodecode.com/rhodecode-startup-scripts/files/be62c3b6... if you wish.

    P.S. Marcin, would you mind removing the Out of Office autoreply my Outlook sent? (My post from Nov. 5)

  8. Support Staff 6 Posted by Marcin Kuzminsk... on 10 Nov, 2014 05:38 PM

    Marcin Kuzminski's Avatar

    Awesome, i added it to the script, and removed you OOF post :)

  9. Marcin Kuzminski closed this discussion on 10 Nov, 2014 05:38 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac