-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidekiq
executable file
·52 lines (45 loc) · 846 Bytes
/
sidekiq
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
#!/bin/bash --login
cd $(dirname $0);
NAME="sidekiq"
start(){
start_default
}
start_default(){
pid_file="tmp/pids/sidekiq.pid"
if [[ -f $pid_file && -n "$(ps -p `cat $pid_file` -o pid=)" ]]; then
echo "$NAME(default) service already running."
else
bundle exec $NAME -e production -d --logfile log/sidekiq.log --pidfile $pid_file
echo "$NAME(default) service started."
fi
}
stop(){
stop_default
}
stop_default(){
pid_file="tmp/pids/sidekiq.pid"
if [[ -f $pid_file && -n "$(ps -p `cat $pid_file` -o pid=)" ]];then
echo "$NAME(default) stopping ..."
bundle exec sidekiqctl stop $pid_file
else
echo "$NAME(default) current service already stop."
fi
}
restart(){
stop
sleep 3s
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: sidekiq start|stop|restart"
esac