-
Notifications
You must be signed in to change notification settings - Fork 7
/
kill_test.sh
executable file
·56 lines (49 loc) · 1.33 KB
/
kill_test.sh
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
#! /bin/bash
# This script kills the tmux session started in start_test.sh and
# removes all the data pertaining to the test.
FRONTEND=true
BACKEND=true
while [[ $# -gt 0 ]]; do
case $1 in
-h | --help)
echo "This script is creating n dela voting nodes"
echo "Options:"
echo "-h | --help program help (this file)"
echo "-f | --frontend kill the frontend true/false, by default true"
echo "-b | --backend kill the backend true/false, by default true"
exit 0
;;
-f | --frontend)
FRONTEND="$2"
shift # past argument
shift # past value
;;
-b | --backend)
BACKEND="$2"
shift # past argument
shift # past value
;;
-* | --*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
shift # past argument
;;
esac
done
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
set -o errexit
command -v tmux >/dev/null 2>&1 || {
echo >&2 "tmux is not on your PATH!"
exit 1
}
if [ "$FRONTEND" = true ]; then
tmux send-keys -t $s:{end} C-c
tmux kill-window -t $s:{end}
fi
if [ "$BACKEND" = true ]; then
tmux send-keys -t $s:{end} C-c
fi
rm -rf /tmp/node* && tmux kill-session -t d-voting-test