-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathlogs.sh
More file actions
executable file
·39 lines (35 loc) · 810 Bytes
/
logs.sh
File metadata and controls
executable file
·39 lines (35 loc) · 810 Bytes
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
usage() {
echo "Usage: $0 [--merge]" 1>&2
}
MERGE="nomerge"
while [[ "$#" -gt 0 ]]; do
case "$1" in
--merge)
shift
MERGE="merge"
;;
*)
echo "unexpected argument $1"
usage
exit 1
esac
done
out=""
for containerid in $(docker ps -a --format "{{.Names}}"); do
if [[ $containerid == sigma-* ]] || [[ $containerid == kernel-* ]]; then
ctr_out="$(docker logs $containerid 2>&1)"
if [[ "$MERGE" == "merge" ]] ; then
out="$(printf "%s\n" "$out" "$ctr_out")"
else
out="$(printf "%s\n" "$out" "========== Logs for $containerid ==========" "$ctr_out")"
fi
fi
done
# Trim first line (which is blank)
out="$(echo "$out" | tail -n +2 )"
if [[ "$MERGE" == "merge" ]] ; then
out="$(echo "$out" | sort -k 1)"
fi
echo "$out"
echo "nproc: $(nproc)"