Commit 9501495a authored by Douwe Maan's avatar Douwe Maan

Fix init.d script.

parent 41fdd20c
...@@ -85,7 +85,7 @@ check_pids(){ ...@@ -85,7 +85,7 @@ check_pids(){
wait_for_pids(){ wait_for_pids(){
# We are sleeping a bit here mostly because sidekiq is slow at writing it's pid # We are sleeping a bit here mostly because sidekiq is slow at writing it's pid
i=0; i=0;
while [ ! -f $web_server_pid_path ] || [ ! -f $sidekiq_pid_path ] || { [ "$mail_room_enabled" = true ] && [ ! -f $mail_room_pid_path ] }; do while [ ! -f $web_server_pid_path ] || [ ! -f $sidekiq_pid_path ] || { [ "$mail_room_enabled" = true ] && [ ! -f $mail_room_pid_path ]; }; do
sleep 0.1; sleep 0.1;
i=$((i+1)) i=$((i+1))
if [ $((i%10)) = 0 ]; then if [ $((i%10)) = 0 ]; then
...@@ -128,7 +128,7 @@ check_status(){ ...@@ -128,7 +128,7 @@ check_status(){
mail_room_status="-1" mail_room_status="-1"
fi fi
fi fi
if [ $web_status = 0 ] && [ $sidekiq_status = 0 ] && { [ "$mail_room_enabled" != true ] || [ $mail_room_status = 0 ] }; then if [ $web_status = 0 ] && [ $sidekiq_status = 0 ] && { [ "$mail_room_enabled" != true ] || [ $mail_room_status = 0 ]; }; then
gitlab_status=0 gitlab_status=0
else else
# http://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html # http://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
...@@ -168,7 +168,7 @@ check_stale_pids(){ ...@@ -168,7 +168,7 @@ check_stale_pids(){
## If no parts of the service is running, bail out. ## If no parts of the service is running, bail out.
exit_if_not_running(){ exit_if_not_running(){
check_stale_pids check_stale_pids
if [ "$web_status" != "0" ] && [ "$sidekiq_status" != "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" != "0" ] }; then if [ "$web_status" != "0" ] && [ "$sidekiq_status" != "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" != "0" ]; }; then
echo "GitLab is not running." echo "GitLab is not running."
exit exit
fi fi
...@@ -179,13 +179,13 @@ start_gitlab() { ...@@ -179,13 +179,13 @@ start_gitlab() {
check_stale_pids check_stale_pids
if [ "$web_status" != "0" ]; then if [ "$web_status" != "0" ]; then
echo -n "Starting GitLab Unicorn" echo "Starting GitLab Unicorn"
fi fi
if [ "$sidekiq_status" != "0" ]; then if [ "$sidekiq_status" != "0" ]; then
echo -n "Starting GitLab Sidekiq" echo "Starting GitLab Sidekiq"
fi fi
if [ "$mail_room_enabled" = true ] && [ "$mail_room_status" != "0" ]; then if [ "$mail_room_enabled" = true ] && [ "$mail_room_status" != "0" ]; then
echo -n "Starting GitLab MailRoom" echo "Starting GitLab MailRoom"
fi fi
# Then check if the service is running. If it is: don't start again. # Then check if the service is running. If it is: don't start again.
...@@ -225,13 +225,13 @@ stop_gitlab() { ...@@ -225,13 +225,13 @@ stop_gitlab() {
exit_if_not_running exit_if_not_running
if [ "$web_status" = "0" ]; then if [ "$web_status" = "0" ]; then
echo -n "Shutting down GitLab Unicorn" echo "Shutting down GitLab Unicorn"
fi fi
if [ "$sidekiq_status" = "0" ]; then if [ "$sidekiq_status" = "0" ]; then
echo -n "Shutting down GitLab Sidekiq" echo "Shutting down GitLab Sidekiq"
fi fi
if [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ]; then if [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ]; then
echo -n "Shutting down GitLab MailRoom" echo "Shutting down GitLab MailRoom"
fi fi
# If the Unicorn web server is running, tell it to stop; # If the Unicorn web server is running, tell it to stop;
...@@ -248,11 +248,11 @@ stop_gitlab() { ...@@ -248,11 +248,11 @@ stop_gitlab() {
fi fi
# If something needs to be stopped, lets wait for it to stop. Never use SIGKILL in a script. # If something needs to be stopped, lets wait for it to stop. Never use SIGKILL in a script.
while [ "$web_status" = "0" ] || [ "$sidekiq_status" = "0" ] || { [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ] }; do while [ "$web_status" = "0" ] || [ "$sidekiq_status" = "0" ] || { [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ]; }; do
sleep 1 sleep 1
check_status check_status
printf "." printf "."
if [ "$web_status" != "0" ] && [ "$sidekiq_status" != "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" != "0" ] }; then if [ "$web_status" != "0" ] && [ "$sidekiq_status" != "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" != "0" ]; }; then
printf "\n" printf "\n"
break break
fi fi
...@@ -272,7 +272,7 @@ stop_gitlab() { ...@@ -272,7 +272,7 @@ stop_gitlab() {
## Prints the status of GitLab and it's components. ## Prints the status of GitLab and it's components.
print_status() { print_status() {
check_status check_status
if [ "$web_status" != "0" ] && [ "$sidekiq_status" != "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" != "0" ] }; then if [ "$web_status" != "0" ] && [ "$sidekiq_status" != "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" != "0" ]; }; then
echo "GitLab is not running." echo "GitLab is not running."
return return
fi fi
...@@ -292,8 +292,8 @@ print_status() { ...@@ -292,8 +292,8 @@ print_status() {
else else
printf "The GitLab MailRoom email processor is \033[31mnot running\033[0m.\n" printf "The GitLab MailRoom email processor is \033[31mnot running\033[0m.\n"
fi fi
end fi
if [ "$web_status" = "0" ] && [ "$sidekiq_status" = "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" = "0" ] }; then if [ "$web_status" = "0" ] && [ "$sidekiq_status" = "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" = "0" ]; }; then
printf "GitLab and all its components are \033[32mup and running\033[0m.\n" printf "GitLab and all its components are \033[32mup and running\033[0m.\n"
fi fi
} }
...@@ -324,7 +324,7 @@ reload_gitlab(){ ...@@ -324,7 +324,7 @@ reload_gitlab(){
## Restarts Sidekiq and Unicorn. ## Restarts Sidekiq and Unicorn.
restart_gitlab(){ restart_gitlab(){
check_status check_status
if [ "$web_status" = "0" ] || [ "$sidekiq_status" = "0" ] || { [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ] }; then if [ "$web_status" = "0" ] || [ "$sidekiq_status" = "0" ] || { [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ]; }; then
stop_gitlab stop_gitlab
fi fi
start_gitlab start_gitlab
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment