-
Notifications
You must be signed in to change notification settings - Fork 1
/
sbf
50 lines (42 loc) · 1.19 KB
/
sbf
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
#!/bin/sh
show_help() {
cat <<EOF
Usage: sbf [options]
Options:
--production Run in production mode (default: development mode)
EOF
}
sbf_mode=development
# Parse command line options
while true; do
case "$1" in
-h|--help|-\?) show_help; exit 0;;
--production) sbf_mode=production; shift ;;
--development) shift ;;
--) shift; break;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
*) break;;
esac
done
# Make sure we have some API keys, otherwise we can't do much
apikeys=config/apikeys.json
if [ ! -f "$apikeys" ]; then
echo "No API keys found in $apikeys" >&2
echo "see https://github.com/sharismlab/" >&2
exit 1
fi
# Start SBF using forever
# /media/Data/Sites/social-brain-framework/node_modules/forever/bin/forever -a -l logs/w.log -c coffee /media/Data/Sites/social-brain-framework/sbf.coffee
case "$sbf_mode" in
production)
# Tell node to run in production mode
NODE_ENV=production
export NODE_ENV
coffee sbf.coffee "$@"
;;
development|*)
# Just run it
exec node_modules/forever/bin/forever -a -l logs/w.log -c coffee sbf.coffee "$@"
;;
esac
exit 1