]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-sidekiq.init
package tmp/{cache/assets,sessions} dirs
[packages/gitlab-ce.git] / gitlab-sidekiq.init
CommitLineData
7db376f0
ER
1#!/bin/sh
2#
3# gitlab-sidekiq GitLab Sidekiq Worker
4#
5# chkconfig: 345 82 18
6# description: Runs GitLab Sidekiq Worker
7# processname: sidekiq
8
9# Related (kudos @4sak3n0ne):
10# https://github.com/gitlabhq/gitlabhq/issues/1049#issuecomment-8386882
11# https://gist.github.com/3062860
12
13# Source function library
14. /etc/rc.d/init.d/functions
15
16# Get network config
17. /etc/sysconfig/network
18
19# Check that networking is up.
20if is_yes "${NETWORKING}"; then
21 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
22 msg_network_down "GitLab Sidekiq"
23 exit 1
24 fi
25else
26 exit 0
27fi
28
29### Environment variables
30RAILS_ENV="production"
31
32# The username and path to the gitlab source
33USER=git
34APP_PATH=/var/lib/gitlab
35
36# The PID and LOCK files used by unicorn and sidekiq
9003de5f 37pidfile=$APP_PATH/pids/sidekiq.pid
7db376f0
ER
38lockfile=/var/lock/subsys/gitlab-sidekiq
39
40# Get service config - may override defaults
41[ -f /etc/sysconfig/gitlab-sidekiq ] && . /etc/sysconfig/gitlab-sidekiq
42
43start() {
44 # Check if the service is already running?
45 if [ -f $lockfile ]; then
46 msg_already_running "GitLab Sidekiq"
47 return
48 fi
49
50 msg_starting "GitLab Sidekiq"
51 daemon --pidfile $pidfile --user $USER --chdir "$APP_PATH" \
52 bundle exec \
53 "sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e $RAILS_ENV -P pids/sidekiq.pid -d -L log/sidekiq.log >> log/sidekiq.log 2>&1"
54 RETVAL=$?
55 [ $RETVAL -eq 0 ] && touch $lockfile
56}
57
58stop() {
59 if [ ! -f $lockfile ]; then
60 msg_not_running "GitLab Sidekiq"
61 return
62 fi
63
64 # Stop daemons.
65 msg_stopping "GitLab Sidekiq"
66 killproc --pidfile $pidfile sidekiq
67 rm -f $lockfile
68}
69
7db376f0
ER
70condrestart() {
71 if [ ! -f $lockfile ]; then
72 msg_not_running "GitLab Sidekiq"
73 RETVAL=$1
74 return
75 fi
76
77 stop
78 start
79}
80
81RETVAL=0
82# See how we were called.
83case "$1" in
84 start)
85 start
86 ;;
87 stop)
88 stop
89 ;;
90 restart)
91 stop
92 start
93 ;;
94 try-restart)
95 condrestart 0
96 ;;
97 force-reload)
98 condrestart 7
99 ;;
100 status)
9003de5f 101 status --pidfile $pidfile sidekiq
7db376f0
ER
102 RETVAL=$?
103 ;;
104 *)
105 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
106 exit 3
107esac
108
109exit $RETVAL
This page took 0.083647 seconds and 4 git commands to generate.