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 1
/
init.sh
executable file
·55 lines (49 loc) · 1.52 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
#!/usr/bin/env sh
#
# Chicago Boss Init System
#
# @author: Jose Luis Gordo Romero <[email protected]>
#
# -------------------------------------------------------------------
# The shell commands are automatically generated by the boss rebar
# plugin/driver, all configuration params and paths are in boss.config
# -------------------------------------------------------------------
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 "==>")
$START
;;
'start-dev')
# Start Boss in development mode
START_DEV=$(./rebar boss c=start_dev_cmd|grep -v "==>")
$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!!!
eval "$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 "==>")
eval "$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