summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorGitLab <devaroop123@yahoo.co.in>2014-02-06 19:47:21 +0530
committerGitLab <devaroop123@yahoo.co.in>2014-02-06 19:47:21 +0530
commitb1492a2a627d1fe51f5cdd5423169247a188f7e4 (patch)
treedf6956064d849616c20d2014b0a23412bdb702a5 /script
parent1c9a41e0d5cac3ee937555ae4189ecd1ad597004 (diff)
parent319f355aeda3fa67c1bc4451c4db5787090ab8af (diff)
downloadgitlab-ce-b1492a2a627d1fe51f5cdd5423169247a188f7e4.tar.gz
sync with upstream for ease to merge
Diffstat (limited to 'script')
-rwxr-xr-xscript/background_jobs56
-rw-r--r--script/upgrade.rb3
-rwxr-xr-xscript/web49
3 files changed, 108 insertions, 0 deletions
diff --git a/script/background_jobs b/script/background_jobs
new file mode 100755
index 00000000000..623e26a2831
--- /dev/null
+++ b/script/background_jobs
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+cd $(dirname $0)/..
+app_root=$(pwd)
+sidekiq_pidfile="$app_root/tmp/pids/sidekiq.pid"
+sidekiq_logfile="$app_root/log/sidekiq.log"
+gitlab_user=$(ls -l config.ru | awk '{print $3}')
+
+function stop
+{
+ bundle exec sidekiqctl stop $sidekiq_pidfile >> $sidekiq_logfile 2>&1
+}
+
+function killall
+{
+ pkill -u $gitlab_user -f sidekiq
+}
+
+function restart
+{
+ if [ -f $sidekiq_pidfile ]; then
+ stop
+ fi
+ killall
+ start_sidekiq -d -L $sidekiq_logfile
+}
+
+function start_no_deamonize
+{
+ start_sidekiq
+}
+
+function start_sidekiq
+{
+ bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e $RAILS_ENV -P $sidekiq_pidfile $@ >> $sidekiq_logfile 2>&1
+}
+
+case "$1" in
+ stop)
+ stop
+ ;;
+ start)
+ restart
+ ;;
+ start_no_deamonize)
+ start_no_deamonize
+ ;;
+ restart)
+ restart
+ ;;
+ killall)
+ killall
+ ;;
+ *)
+ echo "Usage: RAILS_ENV=your_env $0 {stop|start|start_no_deamonize|restart|killall}"
+esac
diff --git a/script/upgrade.rb b/script/upgrade.rb
new file mode 100644
index 00000000000..a5caecf8526
--- /dev/null
+++ b/script/upgrade.rb
@@ -0,0 +1,3 @@
+require_relative "../lib/gitlab/upgrader"
+
+Gitlab::Upgrader.new.execute
diff --git a/script/web b/script/web
new file mode 100755
index 00000000000..5464ed040aa
--- /dev/null
+++ b/script/web
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+cd $(dirname $0)/..
+app_root=$(pwd)
+
+unicorn_pidfile="$app_root/tmp/pids/unicorn.pid"
+unicorn_config="$app_root/config/unicorn.rb"
+
+function get_unicorn_pid
+{
+ local pid=$(cat $unicorn_pidfile)
+ if [ -z $pid ] ; then
+ echo "Could not find a PID in $unicorn_pidfile"
+ exit 1
+ fi
+ unicorn_pid=$pid
+}
+
+function start
+{
+ bundle exec unicorn_rails -D -c $unicorn_config -E $RAILS_ENV
+}
+
+function stop
+{
+ get_unicorn_pid
+ kill -QUIT $unicorn_pid
+}
+
+function reload
+{
+ get_unicorn_pid
+ kill -USR2 $unicorn_pid
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ reload)
+ reload
+ ;;
+ *)
+ echo "Usage: RAILS_ENV=your_env $0 {start|stop|reload}"
+ ;;
+esac