-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdjam
executable file
·98 lines (88 loc) · 2.43 KB
/
djam
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
die() {
printf '%s\n' "$1" >&2
exit 1
}
show_usage() {
cat << EOF
Runs JAMScript instances in docker containers.
The docker version of the normal 'jam' commands
djam help - Prints this help.
djam build - Rebuilds another docker image.
djam clean - Cleans up the mess left behind by old runs.
Use this command if errors occur due to incomplete runs.
djam close - Close all tmux terminals opened by the 'term' command.
djam comp - Compile the JAMScript program in the container.
Executable file is copied back to the original folder.
djam exec - Execute the given program in an existing (running) configuration.
djam init - Initializes the delay values for the docker topology.
Saves zones information and starts pumba (net emulator).
djam kill - Kill a particular application or all active applications.
djam list - Lists all the JAMScript programs running in the system.
djam load - Loads the given file into each node in the current topology.
New file goes into the /jamfiles folder.
djam log - Shows the logs written by the C nodes. A good way to
see the debug messages from the C side.
djam pull - Pull the given docker image and make it the default
djam run - Start a device, fog, or cloud
djam term - Reattach to a tmux terminal of a running JAMScript instance
Use the 'list' command to find out the ID to connect.
djam test - Configures a test topology based on the parameter provided in 'init'.
djam stat - Get the configuration status of djam installation.
Type 'djam cmd --help' for more help on the specific command.
EOF
}
if [ -z $1 ] || [ $1 == "help" ]; then
show_usage
exit 0
fi
jcmd=$1
shift 1
params=$@
case $jcmd in
list)
jamlist $params
;;
build)
djambuild $params
;;
init)
djaminit $params
;;
term)
djamterm $params
;;
test)
djamtest $params
;;
kill)
jamkill $params
;;
clean)
jamclean $params
;;
log)
djamlog $params
;;
run)
djamrun $params
;;
close)
jamclose $params
;;
pull)
djampull $params
;;
comp)
djamcompile $params
;;
compile)
djamcompile $params
;;
exec)
djamexec $params
;;
stat)
djamstat $params
;;
esac