This repository has been archived by the owner on Nov 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathunicorn.sh
62 lines (56 loc) · 1.68 KB
/
unicorn.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
BUNDLE=/usr/local/bin/bundle
UNICORN=/usr/local/bin/unicorn_rails
KILL=/bin/kill
APP_ROOT=/var/www/docker_web_ui/current
PID=$APP_ROOT/pids/unicorn.pid
OLD_PID=$APP_ROOT/pids/unicorn.pid.oldbin
CONF=$APP_ROOT/unicorn.conf.rb
GEM_HOME=/var/www/docker_web_ui/shared/bundle/ruby/2.1.0/gems/
export REMOTE_IMAGES=""
export DOCKER_USER=''
export DOCKER_PASSWORD=''
export DOCKER_EMAIL=''
sig () {
test -s "$PID" && kill -$1 `cat $PID`
}
case "$1" in
start)
echo "Starting unicorn rails app ..."
cd $APP_ROOT
$BUNDLE exec unicorn_rails -D -c $CONF
echo "Unicorn rails app started!"
;;
stop)
echo "Stoping unicorn rails app ..."
sig QUIT && exit 0
echo "Not running"
;;
restart)
if [ -f $PID ];
then
echo "Unicorn PID $PID exists"
sig QUIT
sleep 5
$0 start
else
echo "Unicorn rails app is not running. Lets start it up!"
$0 start
fi
;;
status)
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
;;
esac