Skip to content

Rewrote init script.

Ramya Authappan requested to merge github/fork/Rovanion/init-rewrite into master

Created by: Rovanion

Rewrite of the GitLab init-script providing the following features:

  • Conforms to the Debian, and inherently Ubuntu, init-script guidelines.
    • Is a valid POSIX or /bin/sh script as demanded by the guidelines.
  • Keeps track of the Unicorn and Sidekiq and their state separately.
    • Makes sure that both services start and stop appropriately before telling the user that they are or aren't running.
    • Handles cases where one service started and the other didn't. Highlighting it with a red warning text.
    • Knows the running state of both, not just the pids.
    • No longer uses the error prone "ps aux | grep $pid" method for finding out state.
    • Deals with stale pids caused by application crashes.
  • User set variables are properly escaped, ensures that paths with spaces in them work.
  • No more commands in variables as that sometimes leads to odd edge-cases.
  • The script now always runs as the $app_user, not as root or any other user.
  • No longer swallows errors produced.
    • This was my initial reason for rewriting the script: GitLab didn't start after an upgrade and there were nothing in the logs and no errors printed by the init script.
  • Has passed the peer review of #bash on irc.freenode.org

Merge request reports

Loading