File tree Expand file tree Collapse file tree 3 files changed +36
-26
lines changed Expand file tree Collapse file tree 3 files changed +36
-26
lines changed Original file line number Diff line number Diff line change 33# CLI script is a inferface to executes commands on the CLI service.
44# The CLI service contains a set of commands to manage users, namesapces and members.
55
6+ exit_with_error () {
7+ echo " ERROR: ShellHub is not running. Exiting."
8+ exit 1
9+ }
10+
611. " $( dirname " $0 " ) /utils"
712
13+ cd $( dirname $( readlink_f $0 ) ) /../
14+
815DOCKER_COMPOSE=$( evaluate_docker_compose)
16+ SERVICES=$( $DOCKER_COMPOSE ps --format ' {{.Service}}' | tr ' \n' ' ' )
17+
18+ [ -z " $SERVICES " ] && exit_with_error
19+ echo -n " $SERVICES " | awk ' !(/mongo/ && /redis/ && /api/) { exit 1; }' || exit_with_error
920
10- exec $DOCKER_COMPOSE run cli ./cli $@
21+ exec $DOCKER_COMPOSE exec cli ./cli $@
Original file line number Diff line number Diff line change 22
33. " $( dirname " $0 " ) /utils"
44
5- readlink_f () {
6- (if uname | grep -q ' Darwin' ; then
7- # Use greadlink if available, otherwise it behaves like "readlink -f" option
8- if command -v greadlink > /dev/null 2>&1 ; then
9- greadlink -f " $1 "
10- else
11- target_file=" $1 "
12- cd " $( dirname " $target_file " ) "
13- target_file=$( basename " $target_file " )
14-
15- while [ -L " $target_file " ]
16- do
17- target_file=$( readlink " $target_file " )
18- cd " $( dirname " $target_file " ) "
19- target_file=$( basename " $target_file " )
20- done
21-
22- echo " $( pwd -P) /$target_file "
23- fi
24- else
25- readlink -f " $1 "
26- fi)
27- }
28-
295DOCKER_COMPOSE=$( evaluate_docker_compose)
30-
316WORKDIR=$( dirname $( readlink_f $0 ) ) /../
327
338cd $WORKDIR
Original file line number Diff line number Diff line change @@ -23,6 +23,30 @@ evaluate_docker_compose() {
2323 echo " $COMPOSE_COMMAND "
2424}
2525
26+ readlink_f () {
27+ (if uname | grep -q ' Darwin' ; then
28+ # Use greadlink if available, otherwise it behaves like "readlink -f" option
29+ if command -v greadlink > /dev/null 2>&1 ; then
30+ greadlink -f " $1 "
31+ else
32+ target_file=" $1 "
33+ cd " $( dirname " $target_file " ) "
34+ target_file=$( basename " $target_file " )
35+
36+ while [ -L " $target_file " ]
37+ do
38+ target_file=$( readlink " $target_file " )
39+ cd " $( dirname " $target_file " ) "
40+ target_file=$( basename " $target_file " )
41+ done
42+
43+ echo " $( pwd -P) /$target_file "
44+ fi
45+ else
46+ readlink -f " $1 "
47+ fi)
48+ }
49+
2650set -o allexport
2751
2852env_override=${ENV_OVERRIDE:- ./ .env.override}
You can’t perform that action at this time.
0 commit comments