This repository has been archived by the owner on Apr 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.sh
executable file
·65 lines (58 loc) · 1.74 KB
/
init.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
63
64
65
#!/usr/bin/env sh
#
# Chicago Boss Init System
#
# @author: Jose Luis Gordo Romero <[email protected]>
# @author: Rune Juhl Jacobsen <[email protected]>
#
# -------------------------------------------------------------------
# The shell commands are automatically generated by the boss rebar
# plugin/driver, all configuration params and paths are in boss.config
# -------------------------------------------------------------------
do_start () {
if test $(echo "$1" | grep ERROR > /dev/null;echo $?) -eq 0
then
echo "$1"
else
eval $1
fi
}
cd `dirname $0`
case "${1:-''}" in
'start')
# Start Boss in production mode
echo "starting boss in production mode..."
START=$(./rebar boss c=start_cmd|grep -v "==>")
do_start "$START"
;;
'start-dev')
# Start Boss in development mode
START_DEV=$(./rebar boss c=start_dev_cmd|grep -v "==>")
do_start "$START_DEV"
;;
'stop')
# Stop Boss daemon
echo "stopping boss..."
STOP=$(./rebar boss c=stop_cmd|grep -v "==>")
# After hours of shell quoting problems with the erl command,
# eval with the command quoted works!!!
do_start "$STOP"
;;
'reload')
# Boss hot code reload <-- only the actual node, not the entire cluster
echo "Hot code reload, (WARN: Only this node)"
RELOAD=$(./rebar boss c=reload_cmd|grep -v "==>")
do_start "$RELOAD"
;;
'restart')
# Boss complete restart
echo "Restarting (stop-start) boss..."
$0 stop
$0 start
;;
*)
echo "Chicago Boss Boot System"
echo "Usage: $SELF start|start-dev|stop|reload|restart"
exit 1
;;
esac