forked from coopengo/coog-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
net
executable file
·39 lines (33 loc) · 773 Bytes
/
net
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
#!/bin/bash
# vim: set ft=sh:
# this script creates a docker network for coog
get_dir() {
local script_path; script_path=$(readlink -f "$0")
local script_dir; script_dir=$(dirname "$script_path")
echo "$script_dir"
}
_create() {
docker network create "$NETWORK_NAME"
}
_rm() {
docker network rm "$NETWORK_NAME"
}
usage() {
echo
echo Available commands
echo
echo " create -> creates coog network"
echo " rm -> removes coog network"
echo
}
main() {
source "$(get_dir)/config"
#
[ -z "$1" ] && usage && return 0
local cmd; cmd=$1; shift
#
[ "$cmd" = "create" ] && { _create "$@"; return $?; }
[ "$cmd" = "rm" ] && { _rm "$@"; return $?; }
echo "bad command" && return 1
}
main "$@"